From 1508333316d70a93b3e4e0596cda09b95c0dc135 Mon Sep 17 00:00:00 2001 From: Ryan Jensen Date: Sun, 25 Feb 2024 14:40:27 -0600 Subject: [PATCH] Highlight selected commit's backgrounds with painter->fillRect Qt was adding additional highlighting that was distracting. This commit fixes that issue by manually drawing the highlighted background color instead of relying on Qt to do that. See https://github.com/Murmele/Gittyup/issues/699 --- src/ui/CommitList.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/ui/CommitList.cpp b/src/ui/CommitList.cpp index 21a923f5..b33b75cd 100644 --- a/src/ui/CommitList.cpp +++ b/src/ui/CommitList.cpp @@ -635,9 +635,6 @@ public: Settings::instance()->value(Setting::Id::ShowCommitsId, true).toBool(); LayoutConstants constants = layoutConstants(compact); - // Draw background. - QStyledItemDelegate::paint(painter, opt, index); - bool active = (opt.state & QStyle::State_Active); bool selected = (opt.state & QStyle::State_Selected); auto group = active ? QPalette::Active : QPalette::Inactive; @@ -646,10 +643,16 @@ public: QPalette palette = Application::theme()->commitList(); QColor text = palette.color(group, textRole); QColor bright = palette.color(group, brightRole); + QColor highlight = palette.color(group, QPalette::Highlight); painter->save(); painter->setRenderHints(QPainter::Antialiasing); + // Draw background. + if (selected) { + painter->fillRect(opt.rect, highlight); + } + // Draw busy indicator. if (opt.features & QStyleOptionViewItem::HasDecoration) { QRect rect = decorationRect(option, index);