chore: move opacity after checkbox draw (#3848)

This commit is contained in:
Seth Flynn 2025-06-10 06:51:20 -04:00 committed by GitHub
commit d68269eca8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -20,9 +20,6 @@ void ProjectItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem& o
auto isChecked = opt.checkState == Qt::Checked;
auto isSelected = option.state & QStyle::State_Selected;
if (!isSelected && !isChecked && isInstalled) {
painter->setOpacity(0.4); // Fade out the entire item
}
const QStyle* style = opt.widget == nullptr ? QApplication::style() : opt.widget->style();
auto rect = opt.rect;
@ -39,6 +36,9 @@ void ProjectItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem& o
rect.setX(checkboxOpt.rect.right());
}
if (!isSelected && !isChecked && isInstalled) {
painter->setOpacity(0.4); // Fade out the entire item
}
// The default icon size will be a square (and height is usually the lower value).
auto icon_width = rect.height(), icon_height = rect.height();
int icon_x_margin = (rect.height() - icon_width) / 2;