mirror of
https://github.com/Murmele/Gittyup.git
synced 2024-11-03 21:24:30 +03:00
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:
parent
fca7ee6b50
commit
1508333316
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user