[Qt-interest] QPlainTextEdit or QPlainText

Ferenc Stelcz ferenc at stelcz.hu
Fri Jun 12 16:45:11 CEST 2009


Patric wrote:
> Hello, 
> I want to implement a simple warning console for my application. I.e, when error occure, or an event (the error line should be red, the ordinary line no), there will be a message visualized in that console. 
> Which widget is best for this purpose ? And how to change the color only for one line, instead of all the lines ? 
> 

Quick thought:

I would reimplement the debug methods of Qt, then use qInstallMsgHandler to 
activate them. Would use a QTextEdit with rich-text support. Then in the 
message handlers I would print some red colored html for qWarning and black 
colored html for qDebug into the QTextEdit. (something like <p><font 
color="red">this is an error</font></p>) This is ugly and old-style but a 
solution. :) :)

HTH

--
Ferenc Stelcz
Junior Software Engineer

Banyan Technologies LLC.


__________ Information from ESET Smart Security, version of virus signature database 4150 (20090612) __________

The message was checked by ESET Smart Security.

http://www.eset.com





More information about the Qt-interest-old mailing list