[Qt-interest] Bold fonts
Oliver Demetz
forenbeitraege at oliverdemetz.de
Tue Jul 28 13:53:34 CEST 2009
Hi,
I'm afraid this question is too basic, but
I can't get the following to work:
I have a button which is rendered as usual,
with normal font. Now thare are situations,
where I would like this button to have a *bold*
font, eg. on hover, or if an associated action is
active.
For the hover-effect, I tried to use stylesheets:
QPushButton{
font-weight:normal;
}
QPushButton:hover {
font-weight: bold;
}
But no success.
For the activity indication of a button I have this
piece of code:
if(m_mirror_button.text() == tr("Mirror"))
{
// ---active---
m_mirror_button.setText(tr("Un-Mirror"));
QFont f = m_mirror_button.font();
f.setBold(true);
m_mirror_button.setFont(f);
}
else
{
//---inactive---
m_mirror_button.setText(tr("Mirror"));
QFont f = m_mirror_button.font();
f.setBold(false);
m_mirror_button.setFont(f);
}
but it also does not change anything.
Where is my mistake?
Thanks for your hint in advance.
Olli
More information about the Qt-interest-old
mailing list