PDA

View Full Version : setforeground of a QTextCharFormat



aaditya190
2nd December 2013, 07:08
I am setting the foreground of a QTextCharFormat named as qf.setforeground(Qt::yellow);... There are number of color options but there is no color option for Orange. Can anyone suggest me how to set this to orange color?

stampede
2nd December 2013, 09:36
You can use QColor constructor that takes rgb values:


qf.setforeground(QColor(255, 165, 0));

or use one of the color names listed here : SVG color keywords (http://www.w3.org/TR/SVG/types.html#ColorKeywords)


qf.setforeground(QColor("orange"));

aaditya190
2nd December 2013, 09:59
It worked.. Thank You very much...