diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2020-09-10 14:33:14 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2020-09-18 09:33:07 +0000 |
commit | 4376bc1e3979a6cfb7a3a431207a4ca6694ad501 (patch) | |
tree | b9acd35a7f64b97f7a03819c33981511edf786b0 /src/plugins/texteditor/texteditorplugin.cpp | |
parent | 03983a26483ca9a27babecc73681765c50af1ae0 (diff) |
Core: Allow different highlight colors in search result window
... and make use of that in CppTool's "Find Usages" by assigning
different colors to read and write accesses.
Fixes: QTCREATORBUG-12734
Change-Id: I067db2c8d693bb2c5be44249931ee4f0269f7e52
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Diffstat (limited to 'src/plugins/texteditor/texteditorplugin.cpp')
-rw-r--r-- | src/plugins/texteditor/texteditorplugin.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/plugins/texteditor/texteditorplugin.cpp b/src/plugins/texteditor/texteditorplugin.cpp index 6c614a36b3..2fcad58e37 100644 --- a/src/plugins/texteditor/texteditorplugin.cpp +++ b/src/plugins/texteditor/texteditorplugin.cpp @@ -250,11 +250,20 @@ ExtensionSystem::IPlugin::ShutdownFlag TextEditorPlugin::aboutToShutdown() void TextEditorPluginPrivate::updateSearchResultsFont(const FontSettings &settings) { if (auto window = SearchResultWindow::instance()) { + const Format textFormat = settings.formatFor(C_TEXT); + const Format defaultResultFormat = settings.formatFor(C_SEARCH_RESULT); + const Format alt1ResultFormat = settings.formatFor(C_SEARCH_RESULT_ALT1); + const Format alt2ResultFormat = settings.formatFor(C_SEARCH_RESULT_ALT2); window->setTextEditorFont(QFont(settings.family(), settings.fontSize() * settings.fontZoom() / 100), - settings.formatFor(C_TEXT).foreground(), - settings.formatFor(C_TEXT).background(), - settings.formatFor(C_SEARCH_RESULT).foreground(), - settings.formatFor(C_SEARCH_RESULT).background()); + {std::make_pair(SearchResultColor::Style::Default, + SearchResultColor(textFormat.background(), textFormat.foreground(), + defaultResultFormat.background(), defaultResultFormat.foreground())), + std::make_pair(SearchResultColor::Style::Alt1, + SearchResultColor(textFormat.background(), textFormat.foreground(), + alt1ResultFormat.background(), alt1ResultFormat.foreground())), + std::make_pair(SearchResultColor::Style::Alt2, + SearchResultColor(textFormat.background(), textFormat.foreground(), + alt2ResultFormat.background(), alt2ResultFormat.foreground()))}); } } |