[Qt-interest] QTextEdit line color

RZ rz at razfazz.at
Tue Feb 10 21:35:30 CET 2009


Hi all,

I got a QTextEdit where the user can insert several lines; each line is 
a kind of "command". These commands get processed one after the other. 
What i want to achieve is that each line changes its color after 
"execution".
First intent was to use QSyntaxHighlighter - but this works on the text 
of each line. Not usable for me as the text doesn't change after execution.
My next idea was to iterate over all the QTextBlock's 
(textEdit->document().begin() and callin next()). For each block I can 
get the QTextBlockFormat and can change the foreground of the 
QTextBlockFormat via setForeground(). _But_ there is no way to set a 
QTextBlockFormat to the QTextBlock.

So I'd appreciate any help.

Thx,

RZ



More information about the Qt-interest-old mailing list