Commit ac86fcb0 authored by Waqar Ahmed's avatar Waqar Ahmed Committed by Christoph Cullmann
Browse files

search: Give file items a slightly different background color

Otherwise it appears like a white wall of text and its hard to tell
apart search results from file items.
parent 60fe7c7f
Pipeline #142649 passed with stage
in 3 minutes and 41 seconds
......@@ -41,6 +41,8 @@ SearchResultsDelegate::SearchResultsDelegate(QObject *parent)
m_curLineHighlightColor = QColor::fromRgba(theme.editorColor(KSyntaxHighlighting::Theme::CurrentLine));
m_searchColor = QColor::fromRgba(theme.editorColor(KSyntaxHighlighting::Theme::SearchHighlight));
m_replaceColor = QColor::fromRgba(theme.editorColor(KSyntaxHighlighting::Theme::ReplaceHighlight));
QColor altBase = QColor::fromRgba(theme.editorColor(KSyntaxHighlighting::Theme::BackgroundColor));
m_altBase = altBase.lightness() > 127 ? altBase.darker(125) : altBase.lighter(125);
};
connect(e, &KTextEditor::Editor::configChanged, this, updateColors);
updateColors();
......@@ -159,6 +161,9 @@ void SearchResultsDelegate::paint(QPainter *painter, const QStyleOptionViewItem
// draw item without text
options.text = QString();
if (!isMatchItem(index)) {
options.backgroundBrush = m_altBase;
}
options.widget->style()->drawControl(QStyle::CE_ItemViewItem, &options, painter, options.widget);
if (isMatchItem(index)) {
......
......@@ -32,6 +32,7 @@ private:
QBrush m_textColor;
QBrush m_searchColor;
QBrush m_replaceColor;
QBrush m_altBase;
};
#endif
Markdown is supported
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