[Qt-interest] Generic highlighter
NoRulez
norulez at me.com
Wed Nov 17 09:59:55 CET 2010
Maybe I do something wrong, but Ive extracted the required sources.
Now to highlight a python source in a QPlainTextEdit I do:
pHighlighter = new TextEditor::Internal::Highlighter(0);
QSharedPointer<TextEditor::Internal::HighlightDefinition>
tmpDefinition(new TextEditor::Internal::HighlightDefinition);
TextEditor::Internal::HighlightDefinitionHandler
highlightHandler(tmpDefinition);
const QSharedPointer<TextEditor::Internal::HighlightDefinition>
&definition = highlightHandler.definition(QApplication::applicationDirPath()
+ "/python.xml");
if (!definition.isNull())
pHighlighter->setDefaultContext(definition->initialContext());
m_ui->xmlContent->setHighlighter(pHighlighter);
The setHighlighter() function is implemented in a subclass of a
QPlainTextEdit as followed:
if (m_pHighlighter)
delete m_pHighlighter;
m_pHighlighter = pHighlighter;
m_pHighlighter->setParent(this);
m_pHighlighter->setDocument(document());
But nothing is highlighted, what is wrong here?
I used the python.xml from here:
http://gitorious.org/kate/kate/trees/master/part/syntax/data
The python.xml is loaded successfully
Thanks in advance
Best Regards
NoRulez
Von: qt-interest-bounces at trolltech.com
[mailto:qt-interest-bounces at trolltech.com] Im Auftrag von Diego Iastrubni
Gesendet: Samstag, 13. November 2010 12:48
Cc: qt-interest at trolltech.com
Betreff: Re: [Qt-interest] Generic highlighter
Just randomly speaking... I do want to for this as a stand alone component.
Is anyone willing to help with this? I do see that there is demand for this
kind of component.
On Sat, Nov 13, 2010 at 10:44 AM, Sean Harmer
<sean.harmer at maps-technology.com> wrote:
On Friday 12 November 2010 22:07:19 Diego Iastrubni wrote:
> On Fri, Nov 12, 2010 at 5:00 PM, Sean Harmer <
> > The generic syntax highlighter stuff is all in one dir, namely:
> >
> > qt-creator/src/plugins/texteditor/generichighlighter
>
> Not exactly true. The highlighter is interlaced with many other internal
> components. It's not implssible to take this out, but ti's a great del of
> work, and not trivial. I started doing this a few months ago, but decided
> to stop as I noticed that Leonardo is still hacking inside Nokia on the
> official version. Making a fork is smart only after the official version
> is stable.
OK, fair enough. I only gave it a cursory glance.
Sean
_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20101117/66613c1d/attachment.html
More information about the Qt-interest-old
mailing list