aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/cppeditor/cppeditordocument.cpp
diff options
context:
space:
mode:
authorDavid Schulz <david.schulz@qt.io>2019-06-13 09:56:39 +0200
committerDavid Schulz <david.schulz@qt.io>2019-06-19 11:57:47 +0000
commit2eddd65596d8a10e4f3778a974e1939a9e1ca9f9 (patch)
tree6cffce5f512fe24e140ba18bef15e58b3e80ddd0 /src/plugins/cppeditor/cppeditordocument.cpp
parentc05ec2833e91af55a8fc93546e2577860039bdbb (diff)
TextEditor: add convenience function to clear all extra highlights
Change-Id: Id3a3c45041a23ba100447d926ed6ab829abbc92b Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
Diffstat (limited to 'src/plugins/cppeditor/cppeditordocument.cpp')
-rw-r--r--src/plugins/cppeditor/cppeditordocument.cpp10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/plugins/cppeditor/cppeditordocument.cpp b/src/plugins/cppeditor/cppeditordocument.cpp
index c4af4b1559..9574ed0e8d 100644
--- a/src/plugins/cppeditor/cppeditordocument.cpp
+++ b/src/plugins/cppeditor/cppeditordocument.cpp
@@ -176,14 +176,8 @@ QByteArray CppEditorDocument::contentsText() const
void CppEditorDocument::applyFontSettings()
{
- if (TextEditor::SyntaxHighlighter *highlighter = syntaxHighlighter()) {
- // Clear all additional formats since they may have changed
- QTextBlock b = document()->firstBlock();
- while (b.isValid()) {
- highlighter->clearExtraFormats(b);
- b = b.next();
- }
- }
+ if (TextEditor::SyntaxHighlighter *highlighter = syntaxHighlighter())
+ highlighter->clearAllExtraFormats(); // Clear all additional formats since they may have changed
TextDocument::applyFontSettings(); // rehighlights and updates additional formats
if (m_processor)
m_processor->semanticRehighlight();