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
......@@ -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;
......
......@@ -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()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment