[Qt-interest] Generic Highlighter with multiple definitions for one file?
Diego Iastrubni
diegoiast at gmail.com
Sun Jul 10 22:57:16 CEST 2011
On Sun, Jul 10, 2011 at 9:28 PM, NoRulez <norulez at me.com> wrote:
> QString definitionFile = ":/syntax/html.xml";
> TextEditor::Internal::Highlighter *pHighlighter = new
> TextEditor::Internal::Highlighter();
> const QSharedPointer<TextEditor::Internal::HighlightDefinition> definition
> = TextEditor::Internal::Manager::instance()->definition(definitionFile);
>
Yes, as I expected. You should not load the definition manually. There is a
manager that does the loading for you. It knows how to properly "nest" the
highlighters. See this code:
http://code.google.com/p/qtedit4/source/browse/tools/qtsourceview/demos/demo6/demo6.cpp#89
The base of those files is called a "context". A context can be inside that
XML, or be loaded from a second XML. This is actually done in
HighlightDefinitionHandler::processIncludeRules() (this is the classs that
loads the deinitions from the XML files)
http://code.google.com/p/qtedit4/source/browse/tools/qtsourceview/src/qate/highlightdefinitionhandler.cpp#428
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110710/a3e978d4/attachment.html
More information about the Qt-interest-old
mailing list