diff options
author | Artem Sokolovskii <artem.sokolovskii@qt.io> | 2023-12-13 14:52:44 +0100 |
---|---|---|
committer | Artem Sokolovskii <artem.sokolovskii@qt.io> | 2023-12-14 13:28:22 +0000 |
commit | 3208dc92d36c6e2f91f138c1ca000e4d0fc3f848 (patch) | |
tree | 195297ba93eb9d5beff7e00e81ac7f927d415a36 /src/plugins/texteditor/syntaxhighlighter.cpp | |
parent | 0c9f5c99e7fec8ab690ad91578246bd8a63e7ed6 (diff) |
SyntaxHighlighter: Remove using global fontSettings
Currently, default font settings are set inside the highlighter
runner after creating a highlighter. It prevents to call
TextEditorSettings::fontSettings() from non-main threads.
Change-Id: I0c806f0f586c67749cb2964bebdf2bf3c58a5302
Reviewed-by: David Schulz <david.schulz@qt.io>
Diffstat (limited to 'src/plugins/texteditor/syntaxhighlighter.cpp')
-rw-r--r-- | src/plugins/texteditor/syntaxhighlighter.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/plugins/texteditor/syntaxhighlighter.cpp b/src/plugins/texteditor/syntaxhighlighter.cpp index 0d7b4d2ede..36c3977c5e 100644 --- a/src/plugins/texteditor/syntaxhighlighter.cpp +++ b/src/plugins/texteditor/syntaxhighlighter.cpp @@ -27,9 +27,7 @@ class SyntaxHighlighterPrivate SyntaxHighlighter *q_ptr = nullptr; Q_DECLARE_PUBLIC(SyntaxHighlighter) public: - SyntaxHighlighterPrivate() - : SyntaxHighlighterPrivate(TextEditorSettings::fontSettings()) - { } + SyntaxHighlighterPrivate() = default; SyntaxHighlighterPrivate(const FontSettings &fontSettings) { @@ -881,7 +879,7 @@ void SyntaxHighlighter::setTextFormatCategories(const QList<std::pair<int, TextS d->formatCategories = categories; const int maxCategory = Utils::maxElementOr(categories, {-1, C_TEXT}).first; d->formats = QList<QTextCharFormat>(maxCategory + 1); - d->updateFormats(TextEditorSettings::fontSettings()); + d->updateFormats(d->fontSettings); } QTextCharFormat SyntaxHighlighter::formatForCategory(int category) const @@ -925,4 +923,3 @@ void SyntaxHighlighterPrivate::updateFormats(const FontSettings &fontSettings) } } // namespace TextEditor - |