Skip to content

Commit 1508333

Browse files
committedFeb 25, 2024
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 Murmele#699

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed
 

‎src/ui/CommitList.cpp

+6-3
Original file line numberDiff line numberDiff line change
@@ -635,9 +635,6 @@ class CommitDelegate : public QStyledItemDelegate {
635635
Settings::instance()->value(Setting::Id::ShowCommitsId, true).toBool();
636636
LayoutConstants constants = layoutConstants(compact);
637637

638-
// Draw background.
639-
QStyledItemDelegate::paint(painter, opt, index);
640-
641638
bool active = (opt.state & QStyle::State_Active);
642639
bool selected = (opt.state & QStyle::State_Selected);
643640
auto group = active ? QPalette::Active : QPalette::Inactive;
@@ -646,10 +643,16 @@ class CommitDelegate : public QStyledItemDelegate {
646643
QPalette palette = Application::theme()->commitList();
647644
QColor text = palette.color(group, textRole);
648645
QColor bright = palette.color(group, brightRole);
646+
QColor highlight = palette.color(group, QPalette::Highlight);
649647

650648
painter->save();
651649
painter->setRenderHints(QPainter::Antialiasing);
652650

651+
// Draw background.
652+
if (selected) {
653+
painter->fillRect(opt.rect, highlight);
654+
}
655+
653656
// Draw busy indicator.
654657
if (opt.features & QStyleOptionViewItem::HasDecoration) {
655658
QRect rect = decorationRect(option, index);

0 commit comments

Comments
 (0)
Please sign in to comment.