[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: Setting relative font sizes
From:       Raphael Kubo da Costa <kubito () gmail ! com>
Date:       2009-10-24 21:09:16
Message-ID: 68c3445d0910241409g1aac73a3ye77c62dc22d8517 () mail ! gmail ! com
[Download RAW message or body]

On Sat, Oct 24, 2009 at 6:33 PM, Thomas Lübking <thomas.luebking@web.de> wrote:
> "large" afaik should work
> iirc, richtexts labels are silent QTextBrowsers, thus have support for the
> html subset.
I've set the textFormat property in the .ui file to Qt::RichText, but
setting font-size via setStyleSheet or the styleSheet property in the
.ui doesn't work unless it's in pt or px.

> The direct way would of course be:
>
> QFont fnt = widget->font();
> if (fnt.pointSize() > -1)
>   fnt.setPointSize(fnt.pointSize()+n);
> else
>   fnt.setPixelSize(fnt.pixelSizeSize()+m);
> widget->setFont(fnt);
>
> works for sure ;-)
Indeed, it worked :)

Is this the only possible way to do that then?

>
> Thomas
>
> Am Saturday 24 October 2009 schrieb Raphael Kubo da Costa:
>> Hi there,
>>
>> Currently, I have some QLabels with rich text in them, such as "<font
>> size=+1>foo</font>". I'm trying to move this kind of font setting to a
>> style sheet in the .ui, or even set it via QLabel::setStyleSheet,
>> however setting the style sheet to "font-size: larger;" or anything
>> that's not a pixel or point value doesn't work, and I don't know if
>> it's possible to set the size in a relative way (like the +1 that's
>> being used at the moment).
>>
>> Is the current way the only way to give the text a relative size?
>>
>> Cheers,
>> Raphael
>>
>> >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to
>> >> unsubscribe <<
>>
>
>
>>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
>
 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic