[Qt-creator] SyntaxHighlighting for QML

Ziller Eike Eike.Ziller at theqtcompany.com
Tue Apr 14 07:19:41 CEST 2015


> On Apr 13, 2015, at 21:27, filippocucchetto at gmail.com wrote:
> 
>> I fail to understand what you mean with a bridge. What do you want to
>> achieve, in more detail?
> 
> Basically i would like to reuse the QtCreator syntax highlighting in Qml
> for highlight some code.
> Currently, for what i know, the correct way is subclassing the 
> QSyntaxHighlighter and use the QDocument API.
> I didn't digged inside the QtCreator codebase, but i understood that
> currently QtCreator can reuse the syntax highlighting files from the Kate 
> editor. 
> However i don't know how this is done. Does QtCreator use itself a subclass
> of QSyntaxHighlighter?

Almost ;)
We use a slightly modified copy of QSyntaxHighlighter, TextEditor::SyntaxHighlighter.

> or has it a custom mechanism? 
> I possible to extract part of this for plugging in my own application?

The implementation is in src/plugins/texteditor/generichighlighter 
but no idea how much work it would be to rip that part out of Qt Creator. 

> If yes, which are the high level steps that i should follow?
> 
> 
> Thanks,
> F.

Br, Eike

-- 
Eike Ziller, Senior Software Engineer | The Qt Company
Digia Germany GmbH, Rudower Chaussee 13, D-12489 Berlin
Geschäftsführer: Mika Pälsi, Juha Varelius, Tuula Haataja
Sitz der Gesellschaft: Berlin, Registergericht: Amtsgericht Charlottenburg, HRB 144331 B



More information about the Qt-creator mailing list