[QScintilla] Lexer does not work for me

Phil Thompson phil at riverbankcomputing.com
Mon Nov 26 14:00:38 GMT 2012


On Mon, 26 Nov 2012 12:12:28 +0100, wichern <wichern at tzi.de> wrote:
> Hi everyone,
> 
> Im using the current 2.6.2 version of QScintilla with Qt 4.8.2 and try 
> to get an editor with a C++ lexer:
> 
> FcScintillaEditorWidget::FcScintillaEditorWidget(QWidget* a_parent_ptr)
>    : QsciScintilla(a_parent_ptr)
> {
>    QFont l_font;
>    l_font.setFamily("Consolas");
>    l_font.setFixedPitch(true);
>    l_font.setPointSize(10);
> 
>    QsciLexerCPP* l_lexer_ptr = new QsciLexerCPP(this);
>    l_lexer_ptr->setDefaultFont(l_font);
>    this->setLexer(l_lexer_ptr);
> 
>    this->setText("// Hello World \n\nint main() { return 0; }");
> }
> 
> It does display the text with the given lexer font, but there is 
> absolutely no colourization.
> The complete text is in the QsciLexerCPP::Default colour.
> 
> I tried the python lexer too, but with the same result.
> 
> What am I doing wrong?

Impossible to say without a complete example that demonstrates the
problem.

Phil


More information about the QScintilla mailing list