diff options
author | Ihor Ivlev <ivlev.igor@gmail.com> | 2022-05-07 00:44:03 +0300 |
---|---|---|
committer | Ihor Ivlev <ivlev.igor@gmail.com> | 2022-05-25 15:05:25 +0000 |
commit | 6f7e7980d2b604c79507f9165098f783db8ab2e3 (patch) | |
tree | 35a1c59758149649bea3d54824900af59c47e7ee /src/plugins/texteditor/texteditorplugin.cpp | |
parent | 5da36104abecf64f660ce6058430f8d611841851 (diff) |
Display parent functions in the Find Usages menu
To display the parent function, first we find it in displayResults and
store the information to SearchResultItem, then
SearchResultTreeItemDelegate gets the information and renders it.
Similar approach is applied to ClangdClient, in addSearchResultsForFile.
This change also adds default style for containing function highlight in
the search.
Default foreground and background colors are same as usual text colors.
Task-number: QTCREATORBUG-27550
Change-Id: Id1251afa192f8d1232524742b7c211770bcb83fb
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src/plugins/texteditor/texteditorplugin.cpp')
-rw-r--r-- | src/plugins/texteditor/texteditorplugin.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/plugins/texteditor/texteditorplugin.cpp b/src/plugins/texteditor/texteditorplugin.cpp index 6613b43a70..14206d621c 100644 --- a/src/plugins/texteditor/texteditorplugin.cpp +++ b/src/plugins/texteditor/texteditorplugin.cpp @@ -280,16 +280,23 @@ void TextEditorPluginPrivate::updateSearchResultsFont(const FontSettings &settin 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); + const Format containingFunctionResultFormat = + settings.formatFor(C_SEARCH_RESULT_CONTAINING_FUNCTION); window->setTextEditorFont(QFont(settings.family(), settings.fontSize() * settings.fontZoom() / 100), {std::make_pair(SearchResultColor::Style::Default, SearchResultColor(textFormat.background(), textFormat.foreground(), - defaultResultFormat.background(), defaultResultFormat.foreground())), + defaultResultFormat.background(), defaultResultFormat.foreground(), + containingFunctionResultFormat.background(), containingFunctionResultFormat.foreground())), std::make_pair(SearchResultColor::Style::Alt1, SearchResultColor(textFormat.background(), textFormat.foreground(), - alt1ResultFormat.background(), alt1ResultFormat.foreground())), + alt1ResultFormat.background(), alt1ResultFormat.foreground(), + containingFunctionResultFormat.background(), + containingFunctionResultFormat.foreground())), std::make_pair(SearchResultColor::Style::Alt2, SearchResultColor(textFormat.background(), textFormat.foreground(), - alt2ResultFormat.background(), alt2ResultFormat.foreground()))}); + alt2ResultFormat.background(), alt2ResultFormat.foreground(), + containingFunctionResultFormat.background(), + containingFunctionResultFormat.foreground()))}); } } |