forked from qt-creator/qt-creator
GlslEditor: Fix crash in GlslHighlighter
since the async highlighter implementation the parent is not a TextDocument anymore, but a QTextDocument. Pass the required mimeType via the SyntaxHighlighterRunner now to the SyntaxHighlighter. Change-Id: I0afcbe68719195649b4b7040416a743cb01214df Reviewed-by: Artem Sokolovskii <artem.sokolovskii@qt.io>
This commit is contained in:
@@ -61,6 +61,7 @@ public:
|
||||
QList<std::pair<int,TextStyle>> formatCategories;
|
||||
QTextCharFormat whitespaceFormat;
|
||||
bool noAutomaticHighlighting = false;
|
||||
QString mimeType;
|
||||
};
|
||||
|
||||
static bool adjustRange(QTextLayout::FormatRange &range, int from, int charsDelta)
|
||||
@@ -364,6 +365,18 @@ QTextDocument *SyntaxHighlighter::document() const
|
||||
return d->doc;
|
||||
}
|
||||
|
||||
void SyntaxHighlighter::setMimeType(const QString &mimeType)
|
||||
{
|
||||
Q_D(SyntaxHighlighter);
|
||||
d->mimeType = mimeType;
|
||||
}
|
||||
|
||||
QString SyntaxHighlighter::mimeType() const
|
||||
{
|
||||
Q_D(const SyntaxHighlighter);
|
||||
return d->mimeType;
|
||||
}
|
||||
|
||||
/*!
|
||||
\since 4.2
|
||||
|
||||
|
||||
Reference in New Issue
Block a user