aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/texteditor/syntaxhighlighter.cpp
diff options
context:
space:
mode:
authorDavid Schulz <david.schulz@qt.io>2024-01-29 13:43:46 +0100
committerDavid Schulz <david.schulz@qt.io>2024-01-31 13:15:44 +0000
commitd651d8b41fa2ab746dcd912b88b09dbd4af10d13 (patch)
tree81e587560e5edb3997dca413c09900fcadf4f74a /src/plugins/texteditor/syntaxhighlighter.cpp
parent256ae21c07b48be6616d2e14608471c4b63cac1c (diff)
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>
Diffstat (limited to 'src/plugins/texteditor/syntaxhighlighter.cpp')
-rw-r--r--src/plugins/texteditor/syntaxhighlighter.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/plugins/texteditor/syntaxhighlighter.cpp b/src/plugins/texteditor/syntaxhighlighter.cpp
index 5542f4d755..8c9cc19437 100644
--- a/src/plugins/texteditor/syntaxhighlighter.cpp
+++ b/src/plugins/texteditor/syntaxhighlighter.cpp
@@ -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