[Qt-interest] Generic highlighter

NoRulez norulez at me.com
Tue Nov 23 14:22:59 CET 2010


 

Hi,

 

shouldn't this do the highlighter?

 

Best Regards

NoRulez

 

Von: qt-interest-bounces at trolltech.com
[mailto:qt-interest-bounces at trolltech.com] Im Auftrag von Leandro T. C. Melo
Gesendet: Dienstag, 23. November 2010 14:06
An: qt-interest at trolltech.com
Betreff: Re: [Qt-interest] Generic highlighter

 

On 11/23/2010 8:46 AM, ext NoRulez wrote: 

Hi list,

I’ve attached a small example of the generic 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/c091e8dc/attachment.html 


More information about the Qt-interest-old mailing list