[Qt-interest] Bold fonts
Tony Rietwyk
tony.rietwyk at rightsoft.com.au
Wed Jul 29 03:18:55 CEST 2009
Hi Oliver,
Have a look at changing the palette (probably button text role), instead of
the font.
Or, try setting the style sheet property directly on the button.
Regards,
> 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