January 7, 2011

endla.ravi endla.ravi
Lab Rat
6 posts

How to color in textbrowser


How can I color text in LineEdit or TextBrowser

suppose i have

  1. QString message="hello";
  2. ui->textBrowser->append(message);

how can i color the message..
Thanks in advance

1 reply

January 7, 2011

Volker Volker
Ant Farmer
5331 posts

You can enclose the text in html span tags and add the color:

  1. QString message = "<span style='color: red'>hello</span>"

  ‹‹ [SPLIT] Future of Widgets in Qt      Can anyone point me to example code for playing a movie using the Qt Multimedia API? ››

You must log in to post a reply. Not a member yet? Register here!