From c8421e66b6ba439fe4f5fc2bd45b957b446128ee Mon Sep 17 00:00:00 2001 From: Erik Verbruggen <erik.verbruggen@digia.com> Date: Wed, 13 Mar 2013 14:00:11 +0100 Subject: [PATCH] Fix color usage in search result view. Use the text editor's foreground and background colors everywhere. This prevents "zebra patterns" in the text lines when using a dark background color. Change-Id: I9f072fa08e7d90b9840ad1e1fecee993fa14cedb Reviewed-by: David Schulz <david.schulz@digia.com> --- src/plugins/find/searchresulttreemodel.cpp | 12 ++++-------- src/plugins/find/searchresulttreeview.cpp | 4 ++++ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/plugins/find/searchresulttreemodel.cpp b/src/plugins/find/searchresulttreemodel.cpp index 141ff24fa51..ce9d6f9fc7f 100644 --- a/src/plugins/find/searchresulttreemodel.cpp +++ b/src/plugins/find/searchresulttreemodel.cpp @@ -252,12 +252,10 @@ QVariant SearchResultTreeModel::data(const SearchResultTreeItem *row, int role) result = QVariant(); break; case Qt::TextColorRole: - if (row->item.useTextEditorFont) - result = m_color.textForeground; + result = m_color.textForeground; break; case Qt::BackgroundRole: - if (row->item.useTextEditorFont) - result = m_color.textBackground; + result = m_color.textBackground; break; case ItemDataRoles::ResultLineRole: case Qt::DisplayRole: @@ -273,12 +271,10 @@ QVariant SearchResultTreeModel::data(const SearchResultTreeItem *row, int role) result = row->item.icon; break; case ItemDataRoles::ResultHighlightBackgroundColor: - if (row->item.useTextEditorFont) - result = m_color.highlightBackground; + result = m_color.highlightBackground; break; case ItemDataRoles::ResultHighlightForegroundColor: - if (row->item.useTextEditorFont) - result = m_color.highlightForeground; + result = m_color.highlightForeground; break; case ItemDataRoles::SearchTermStartRole: result = row->item.textMarkPos; diff --git a/src/plugins/find/searchresulttreeview.cpp b/src/plugins/find/searchresulttreeview.cpp index 2fa0df88569..281014e95b8 100644 --- a/src/plugins/find/searchresulttreeview.cpp +++ b/src/plugins/find/searchresulttreeview.cpp @@ -61,6 +61,10 @@ void SearchResultTreeView::setAutoExpandResults(bool expand) void SearchResultTreeView::setTextEditorFont(const QFont &font, const SearchResultColor color) { m_model->setTextEditorFont(font, color); + + QPalette p = palette(); + p.setColor(QPalette::Base, color.textBackground); + setPalette(p); } void SearchResultTreeView::clear() -- GitLab