[Qt-interest] How to get the application font color in Qt

Ramesh ramesh.bs at robosoftin.com
Wed Apr 28 13:59:24 CEST 2010


Denis,   Fantastic. it worked J

Thanks u very much ..

 

 

 

 

From: Denis Akhmetzyanov [mailto:dakhmetzyanov at smartlabs.tv] 
Sent: Wednesday, April 28, 2010 5:20 PM
To: Ramesh
Cc: qt-interest at trolltech.com; QtS60-feedback at trolltech.com
Subject: Re: [Qt-interest] How to get the application font color in Qt

 

Hi,

See QPainter::setPen() method.

You could explicitly set target color:

 

     QPainter paint(this);

     paint.setPen(Qt::red);

     paint.drawText(QPoint(10,30),"Duplex");

     

Or use application palette:

 

    paint.setPen(QApplication::palette().text().color());

 

 

2010/4/28 Ramesh <ramesh.bs at robosoftin.com>

Hi,

 

I want to put some text on my UI, I am drawing the text in paint event of a
widget using  painter..

 

Here is the sample code, which shows how I am drawing the text..

 

QWidget::paintEvent(painter);

QPainter paint(this);

paint.drawText(QPoint(10,30),"Duplex");

 

but, the text color is looks like the default theme color, how to set the
application font color to the text in paint event..

 

Thanks &regards

ramesh

 

-----------------------------------------------

Robosoft Technologies - Come home to Technology

Disclaimer: This email may contain confidential material. If you were not an
intended recipient, please notify the sender and delete all copies. Emails
to and from our network may be logged and monitored. This email and its
attachments are scanned for virus by our scanners and are believed to be
safe. However, no warranty is given that this email is free of malicious
content or virus.

 


_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest




-- 
Best regards,
Denis Akhmetzyanov


-----------------------------------------------
Robosoft Technologies - Come home to Technology

Disclaimer: This email may contain confidential material. If you were not an intended recipient, please notify the sender and delete all copies. Emails to and from our network may be logged and monitored. This email and its attachments are scanned for virus by our scanners and are believed to be safe. However, no warranty is given that this email is free of malicious content or virus.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100428/8c9369dd/attachment.html 


More information about the Qt-interest-old mailing list