[QScintilla] How to do AutoCompletion? Is there an example?

Phil Thompson phil at riverbankcomputing.com
Thu Mar 15 14:31:34 GMT 2007


On Monday 12 March 2007 2:17 pm, Timo Rothenpieler wrote:
> Hi.
> I'm using QScintilla with Qt4 in C++ and would like to implement
> Auto-Completion in the IDE I'm writing.
> But i could not find out how to use QsciAPIs to get a working
> Auto-Completion.
> At the moment I'm trying it like this:
>
> ----------
>
> QsciScintilla* sci = new QsciScintilla(this);
> sci->setPaper(QColor(1,81,107));
> sci->setMarginLineNumbers(1,true);
> sci->setFolding(QsciScintilla::CircledTreeFoldStyle);
> sci->setAutoIndent(true);
> sci->setAutoCompletionThreshold(2);
> sci->setAutoCompletionSource(QsciScintilla::AcsAPIs);
>
> QsciLexerBMax lex(sci);
>
> QsciAPIs apis(&lex);
> apis.add("test");
> apis.add("test123");
> apis.add("foobar");
> apis.prepare();
> lex.setAPIs(&apis);
>
> sci->setLexer(&lex);
>
> ----------
>
> But it does not work.
>
> Is there an existing example how to use this, or can somebody give me an
> example?

Apologies for the previous premature answer...

Does it work if you use the QsciLexerPython instead of your QsciLexerBMax 
class?

What is QsciLexerBMax? What does it sub-class from?

BTW, you don't need the call to setAPIs().

Phil


More information about the QScintilla mailing list