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
This commit is contained in:
Ryan Jensen 2024-02-25 14:40:27 -06:00
parent fca7ee6b50
commit 1508333316

View File

@ -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);