[Qt-interest] Bold fonts
John McClurkin
jwm at nei.nih.gov
Tue Jul 28 16:44:48 CEST 2009
Oliver Demetz wrote:
> Point size is 14.
> I do not have any problem with the normal fonts, they are displayed as
> they should.
> Also, if I set the font-weight to bold generally, I get bolf text as
> desired. The problem lies in switching between bold and normal fonts.
>
>
> Donal O'Connor schrieb:
>> 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
>> <mailto: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.
Have you tried calling update() on the button?
>>
>> Olli
>> _______________________________________________
>> Qt-interest mailing list
>> Qt-interest at trolltech.com <mailto:Qt-interest at trolltech.com>
>> http://lists.trolltech.com/mailman/listinfo/qt-interest
>>
>>
More information about the Qt-interest-old
mailing list