Trolltech Home | Qt-embedded-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 1

Qt-embedded-interest Archive, December 2006
Changing the font size and color of lable dynamically


Message 1 in thread

Dear All,
I have Lablle created using QT Designer.
In the run time(inside the program ) i want to change its color and
size of text.
I can able to change the text of lable using  setText(string).
But i coudn't find the API to change the color and font size of text.
If some body had done kindly suggest me how to do it.

Thanks in advance,

Regards,
Harsha

To unsubscribe - send "unsubscribe" in the subject to qt-embedded-interest-request@xxxxxxxxxxxxx


Message 2 in thread

harshavardhanreddy mandeepala wrote:
> Dear All,
> I have Lablle created using QT Designer.
> In the run time(inside the program ) i want to change its color and
> size of text.
> I can able to change the text of lable using  setText(string).
> But i coudn't find the API to change the color and font size of text.
So where did you look? I found this in the docs:
http://doc.trolltech.com/3.3/qlabel.html#setFont

Please do not crosspost between various lists! See 
http://en.wikipedia.org/wiki/Netiquette.

Best,

Andre

To unsubscribe - send "unsubscribe" in the subject to qt-embedded-interest-request@xxxxxxxxxxxxx


Message 3 in thread

please reply to the list.

harshavardhanreddy mandeepala wrote:
> Dear Andre,
> Thanks for your  help.
>
> using
>
>   QFont testFont( "Times", 10, Bold );
> and
> QLabel::setFont ( testFont );
>
> I can change the style and width of font.
> But how can i change the fore ground color  of font.
> I looked into QFont class but i couldn't find.
> If you have an idea kindly help me.
The colour is set with QWidget::setPaletteForegroundColor which is 
reimplemented in QLabel.

You can also change the color by using Richtext:

myLabel->setText("<font color=red>This is a colored label</font>");  or 
alike should do the trick.


Best regards,

Andre

To unsubscribe - send "unsubscribe" in the subject to qt-embedded-interest-request@xxxxxxxxxxxxx


Message 4 in thread

Hi Andre,

Thanks  a lot for your help.

Regards,
Harsha

On 12/19/06, Andre Haupt <haupt.andre@xxxxxx> wrote:
> please reply to the list.
>
> harshavardhanreddy mandeepala wrote:
> > Dear Andre,
> > Thanks for your  help.
> >
> > using
> >
> >   QFont testFont( "Times", 10, Bold );
> > and
> > QLabel::setFont ( testFont );
> >
> > I can change the style and width of font.
> > But how can i change the fore ground color  of font.
> > I looked into QFont class but i couldn't find.
> > If you have an idea kindly help me.
> The colour is set with QWidget::setPaletteForegroundColor which is
> reimplemented in QLabel.
>
> You can also change the color by using Richtext:
>
> myLabel->setText("<font color=red>This is a colored label</font>");  or
> alike should do the trick.
>
>
> Best regards,
>
> Andre
>

To unsubscribe - send "unsubscribe" in the subject to qt-embedded-interest-request@xxxxxxxxxxxxx