[QScintilla] No syntax highlighting with provided example

Phil Thompson phil at riverbankcomputing.com
Wed Dec 20 16:52:08 GMT 2017


On 20 Dec 2017, at 9:54 am, DYNAWORKS, Tools <tools.dynaworks at airbus.com> wrote:
> 
> Hello,
> I have just compiled source code of QScintilla to use it in an editor. All seems good, but I have no syntax highlighting whereas I have created a QsciLexerCPP and set it to the QsciScintilla object. Here is the code I use to test some functionalities :
>  
> #include <QApplication>
> #include <QScintilla/Qsci/qsciscintilla.h>
> #include <QScintilla/Qsci/qscilexercpp.h>
>  
> int main(int argc, char* argv[])
> {
>      QApplication app(argc, argv);
>  
>      QsciLexerCPP *lexerCPP = new QsciLexerCPP;
>      lexerCPP->setColor(Qt::magenta, QsciLexerCPP::Comment);
>  
>      QsciScintilla *scintilla = new QsciScintilla;
>      scintilla->setLexer(lexerCPP);
>      scintilla->SendScintilla(QsciScintilla::SCI_SETHSCROLLBAR, 0);
>      scintilla->setMinimumSize(600, 450);
>      scintilla->setText("#include <toto.hg>\n#define titi 12\n\n\n\n");
>  
>      scintilla->show();
>  
>      return app.exec();
> }
>  
> Here is what I get at program execution, there is no color for specific syntax elements, someone might have an idea of my problem ?

The syntax element here is a pre-processor line and it isn't black.

Enter some more text.

Phil


More information about the QScintilla mailing list