[Solved] Color of QString
-
Hi!
Is it possible to pass color settings with QString?
I create a QString using two Strings (QString1 and QString2) and display in Qtextedit.
I want to show second string (Qstring2) with different color in Qtextedit.Any Guidance?
-
Look here: http://qt-project.org/doc/qt-4.8/qtextedit.html#setTextColor
You can also use html. -
Hi,
Since you are using QTextEdit it supports Rich Text's so you can set an Html to it using "setHtml":http://qt-project.org/doc/qt-5/qtextedit.html#html-prop. Using an Html document you can set lots of properties.
For E.g
@
ui->textEdit->setHtml("<font color="red">Red text</font> <font color="blue">Blue text</font>");
@