[Qt-interest] Bold fonts

Donal O'Connor donaloconnor at gmail.com
Tue Jul 28 13:59:00 CEST 2009


What point size is the text on your button because as far as I know if it
less than 7, then bold does not render?

Not sure, but could possibly be the problem.

On Tue, Jul 28, 2009 at 12:53 PM, Oliver Demetz <
forenbeitraege at oliverdemetz.de> wrote:

> 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
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090728/6e909de7/attachment.html 


More information about the Qt-interest-old mailing list