[Qt-interest] Generic Highlighter with multiple definitions for one file?
NoRulez
norulez at me.com
Sun Jul 10 20:28:29 CEST 2011
Hi,
I use it as followed:
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);
if (definition.isNull()) {
qDebug() << QString("The definition file \"%0\" couldn't be
found").arg(definitionFile);
delete pHighlighter;
pHighlighter = 0;
}
else {
pHighlighter->setDefaultContext(definition->initialContext());
pHighlighter->configureFormat(TextEditor::Internal::Highlighter::Normal,
...);
}
setSyntaxHighlighter(pHighlighter);
Best Regards
NoRulez
-----Ursprüngliche Nachricht-----
Von: Diego Iastrubni [mailto:diegoiast at gmail.com]
Gesendet: Sonntag, 10. Juli 2011 09:00
An: NoRulez
Cc: Scott Aron Bloom; Qt Interest MailingList
Betreff: Re: [Qt-interest] Generic Highlighter with multiple definitions for
one file?
If you are using the HL from QtCreator this should work for you. How
are you loading the HL definition?
On Saturday, July 9, 2011, NoRulez <norulez at me.com> wrote:
> Ok, multiple was the wrong word.I mean for e.g. A PHP/HTML file with
embedded JS and CSS.
>
> Am 09.07.2011 um 17:20 schrieb Scott Aron Bloom
<Scott.Bloom at onshorecs.com>:
>
> Now Im confused
You want, in one file, to have different
highlighters??? If you are thinking something like PHP embedded in HTML
where you want a HTML highlighting outside the PHP tag, you are going to
have to customize the highlighting logic. Scott From: NoRulez
[mailto:norulez at me.com]
> Sent: Saturday, July 09, 2011 7:59 AM
> To: Diego Iastrubni
> Cc: Scott Aron Bloom; NoRulez; Qt Interest MailingList
> Subject: Re: [Qt-interest] Generic Highlighter with multiple definitions
for onefile? Hi, I use already the generic highlighter from the Qt Creator.
My problem is only to highlight multiple sources per file. Could you give me
a little example to show how it works? Best Regards
>
> Am 09.07.2011 um 11:40 schrieb Diego Iastrubni <diegoiast at gmail.com>:The
generic highlighter available in QtCreator can handle this task. It's based
on Kate. You can de-couple it from the IDE and use it in your application.
It's released under LGPL.On Sat, Jul 9, 2011 at 7:27 AM, Scott Aron Bloom
<Scott.Bloom at onshorecs.com> wrote:Use multiple QSyntaxHighlighter, one
setup for each set of rules you
> need..
>
> When a file is loaded select the correct one, and call setDocument on
> the correct highlighter for the editor in use..
>
> Scott
>
> -----Original Message-----
> From: qt-interest-bounces+scott.bloom=onshorecs.com at qt.nokia.com
> [mailto:qt-interest-bounces+scott.bloom=onshorecs.com at qt.nokia.com] On
> Behalf Of NoRulez
> Sent: Friday, July 08, 2011 10:02 AM
> To: Qt Interest MailingList
> Subject: [Qt-interest] Generic Highlighter with multiple definitions for
> onefile?
> Hi,
>
> if I use the generic highlighter per file (e.g. html) it works
> perfectly.
>
> The problem I have is when a file has multiple sources such as a HTML or
> a PHP file. These files could have PHP/HTML source and JavaScript and/or
> CSS for example.
>
> How can I combine such highlighters to highlight the PHP/HTML source and
> also the JS and CSS?
>
> Thanks in advance
>
> Best regards
> NoRulez
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com
> <http://lists.qt.nokia.com/mailman/listinfo/qt-interest>
More information about the Qt-interest-old
mailing list