[Qt-interest] Generic highlighter
Leandro T. C. Melo
leandro.melo at nokia.com
Tue Nov 23 14:06:01 CET 2010
On 11/23/2010 8:46 AM, ext NoRulez wrote:
>
> Hi list,
>
> I’ve attached a small exampleofthegeneric highlighter.
>
> Could anybody please help me to figure out why it didn’t highlight
> anything?
>
Hi.
It looks like your example misses one thing. You need to tell the
highlighter which formats to be used for the matched items. Something
like this:
Highlighter *highlighter = new
Highlighter(ui->plainTextEdit->document());
QTextCharFormat format;
format.setForeground(QColor(Qt::red));
highlighter->configureFormat(Highlighter::Comment, format); //
Configure the format for comments.
Please notice that there are other formats available. Also, make sure
that your app can find the definition file (python.xml in your case).
Regards,
Leandro.
--
Leandro T. C. Melo
Software Engineer
Nokia, Qt Development Frameworks
Nokia gate5 GmbH
Firmensitz: Invalidenstr. 117, 10115 Berlin, Germany
Registergericht: Amtsgericht Charlottenburg, Berlin: HRB 106443B
Umsatzsteueridentifikationsnummer: DE 812 845 193
Geschäftsführer: Dr. Michael Halbherr, Karim Tähtivuori
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20101123/25689787/attachment.html
More information about the Qt-interest-old
mailing list