[PyQt] Question about QsciLexerCustom

projetmbc projetmbc at club-internet.fr
Wed Jun 10 19:26:09 BST 2009


Phil Thompson a écrit :
> On Wed, 10 Jun 2009 15:12:03 +0200, projetmbc <projetmbc at club-internet.fr>
> wrote:
>   
>> Hello,
>> I would like to use QsciLexerCustom so as to define my own lexer. The 
>> documentation says :
>>              "All that is necessary to implement a new lexer is to 
>> define appropriate
>>               styles and to re-implement the styleText() 
>> <classQsciLexerCustom.html#91d71c4bdff5140ae0b0cb34b4511f79> method."
>> This sounds very abstract to me. How can I color a single word like 
>> STRANGE ? How can I define a block like a C++ comment ?
>>     
>
> You have to parse the text you are being asked to style (or find it in a
> data structure you have already created) to determine what style should be
> applied to each character (or group of characters). Apply the style by
> making a call to startStyling() followed by one or more calls to
> setStyling().
>
> Phil

Thanks I'll look at that. When I'll make a functionnal example I'll post 
it here.

Christophe.



More information about the PyQt mailing list