Skip to content
Snippets Groups Projects
Commit c8421e66 authored by Erik Verbruggen's avatar Erik Verbruggen
Browse files

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: default avatarDavid Schulz <david.schulz@digia.com>
parent 41fa8c35
No related branches found
No related tags found
No related merge requests found
...@@ -252,12 +252,10 @@ QVariant SearchResultTreeModel::data(const SearchResultTreeItem *row, int role) ...@@ -252,12 +252,10 @@ QVariant SearchResultTreeModel::data(const SearchResultTreeItem *row, int role)
result = QVariant(); result = QVariant();
break; break;
case Qt::TextColorRole: case Qt::TextColorRole:
if (row->item.useTextEditorFont) result = m_color.textForeground;
result = m_color.textForeground;
break; break;
case Qt::BackgroundRole: case Qt::BackgroundRole:
if (row->item.useTextEditorFont) result = m_color.textBackground;
result = m_color.textBackground;
break; break;
case ItemDataRoles::ResultLineRole: case ItemDataRoles::ResultLineRole:
case Qt::DisplayRole: case Qt::DisplayRole:
...@@ -273,12 +271,10 @@ QVariant SearchResultTreeModel::data(const SearchResultTreeItem *row, int role) ...@@ -273,12 +271,10 @@ QVariant SearchResultTreeModel::data(const SearchResultTreeItem *row, int role)
result = row->item.icon; result = row->item.icon;
break; break;
case ItemDataRoles::ResultHighlightBackgroundColor: case ItemDataRoles::ResultHighlightBackgroundColor:
if (row->item.useTextEditorFont) result = m_color.highlightBackground;
result = m_color.highlightBackground;
break; break;
case ItemDataRoles::ResultHighlightForegroundColor: case ItemDataRoles::ResultHighlightForegroundColor:
if (row->item.useTextEditorFont) result = m_color.highlightForeground;
result = m_color.highlightForeground;
break; break;
case ItemDataRoles::SearchTermStartRole: case ItemDataRoles::SearchTermStartRole:
result = row->item.textMarkPos; result = row->item.textMarkPos;
......
...@@ -61,6 +61,10 @@ void SearchResultTreeView::setAutoExpandResults(bool expand) ...@@ -61,6 +61,10 @@ void SearchResultTreeView::setAutoExpandResults(bool expand)
void SearchResultTreeView::setTextEditorFont(const QFont &font, const SearchResultColor color) void SearchResultTreeView::setTextEditorFont(const QFont &font, const SearchResultColor color)
{ {
m_model->setTextEditorFont(font, color); m_model->setTextEditorFont(font, color);
QPalette p = palette();
p.setColor(QPalette::Base, color.textBackground);
setPalette(p);
} }
void SearchResultTreeView::clear() void SearchResultTreeView::clear()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment