PDA

View Full Version : Qstring



amarnath.rb.tc@gmail.com
29th May 2012, 09:08
how to change text color in Qstring......:):)

Zlatomir
29th May 2012, 09:41
QString doesn't have a text color, it's just a string, not a widget that has a visual representation.

For example if you show your string in a QLabel you can change the color using Qt Style Sheets (http://doc.qt.nokia.comFor/4.7-snapshot/stylesheet.html) like this:


QLabel* w0 = new QLabel("red background and blue text");
w0->setStyleSheet("QLabel { background-color : red; color : blue; }");

See the documentation for other widgets.

amarnath.rb.tc@gmail.com
29th May 2012, 16:29
thanks a lot...

Lykurg
29th May 2012, 16:47
For such a task please use QPalette. The Qt style sheets are not developed further and for that they are pure overhead.