forked from qt-creator/qt-creator
SyntaxHighlighter: Move highlighter creating to TextDocument
Added setSyntaxHighlighterCreator function to TextDocument which allows the creation of highlighters inside TextDocument. Change-Id: I454f800c878c48a154dad5abd68b7a4f9ceb378a Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -901,11 +901,12 @@ bool TextDocument::reload(QString *errorString, ReloadFlag flag, ChangeType type
|
||||
return reload(errorString);
|
||||
}
|
||||
|
||||
void TextDocument::setSyntaxHighlighter(SyntaxHighlighter *highlighter)
|
||||
void TextDocument::setSyntaxHighlighterCreator(const SyntaxHighLighterCreator &creator)
|
||||
{
|
||||
if (d->m_highlighter)
|
||||
delete d->m_highlighter;
|
||||
d->m_highlighter = highlighter;
|
||||
|
||||
d->m_highlighter = creator();
|
||||
d->m_highlighter->setParent(this);
|
||||
d->m_highlighter->setDocument(&d->m_document);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user