On Sat, 6 Nov 2010 18:38:12 +0100, "Jonas O." <[email protected]> wrote: > Hello, and first thanks for bringing Scintilla to Qt ! I'm quite happy > to see all those nifty features made that much simple to implement > (current line highlight, margin numbers, select line form left click > in the margin, etc). > > However I'm having one little problem, I want to color some keyword > sets with a different than other keyword sets. > I created my own lexer by duplicating the QsciLexerCPP files, but I > need some starting point to see how I can do that; the SendScintilla > function is not very documented and does not forward to any scintilla > doc (I also read it's useless to ask here to learn how to create a > lexer, but I just want to color certain separately, not create my own > language). > > I hope someone could help me at least a little, I guess someone have > to know how to do it, the creator of QScintilla maybe ? The QScintilla > lexer classes did not appear magically...
You don't need to create a new lexer - just subclass QsciLexerCPP and reimplement the keywords() method to handle the case where the keyword set is 2 (see QsciLexerCPP::KeywordSet2). You need to return a string for set 2 containing the keywords you want coloured differently. If some of these appear in the default set 1 then you will also need to handle that set by returning a string that doesn't contain those keywords. You may also want to reimplement defaultColor(), defaultFont() etc. to provide different defaults for the KeywordSet2 style. Phil _______________________________________________ QScintilla mailing list [email protected] http://www.riverbankcomputing.com/mailman/listinfo/qscintilla
