mirror of
https://github.com/Murmele/Gittyup.git
synced 2024-09-17 13:37:18 +03:00
Merge pull request #701 from jensenr30/fix-commit-highlighting
Fix commit highlighting
This commit is contained in:
commit
5d8091811d
@ -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);
|
||||
@ -784,7 +787,16 @@ public:
|
||||
// Draw content.
|
||||
git::Commit commit =
|
||||
index.data(CommitList::Role::CommitRole).value<git::Commit>();
|
||||
if (commit.isValid()) {
|
||||
if (!commit.isValid()) {
|
||||
// special case for uncommitted changes
|
||||
QString message = index.model()->data(index).toString();
|
||||
painter->save();
|
||||
QFont italic = opt.font;
|
||||
italic.setItalic(true);
|
||||
painter->setFont(italic);
|
||||
painter->drawText(opt.rect, Qt::AlignCenter, message);
|
||||
painter->restore();
|
||||
} else {
|
||||
const QFontMetrics &fm = opt.fontMetrics;
|
||||
QRect star = rect;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user