feat: fade installed resources in the download dialog
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
parent
6eec17e846
commit
09dcfa4b65
1 changed files with 15 additions and 4 deletions
|
@ -16,13 +16,20 @@ void ProjectItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem& o
|
|||
QStyleOptionViewItem opt(option);
|
||||
initStyleOption(&opt, index);
|
||||
|
||||
auto isInstalled = index.data(UserDataTypes::INSTALLED).toBool();
|
||||
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;
|
||||
|
||||
style->drawPrimitive(QStyle::PE_PanelItemViewItem, &opt, painter, opt.widget);
|
||||
|
||||
if (option.state & QStyle::State_Selected && style->objectName() != "windowsvista")
|
||||
if (isSelected && style->objectName() != "windowsvista")
|
||||
painter->setPen(opt.palette.highlightedText().color());
|
||||
|
||||
if (opt.features & QStyleOptionViewItem::HasCheckIndicator) {
|
||||
|
@ -68,12 +75,16 @@ void ProjectItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem& o
|
|||
{ // Title painting
|
||||
auto title = index.data(UserDataTypes::TITLE).toString();
|
||||
|
||||
if (index.data(UserDataTypes::INSTALLED).toBool())
|
||||
title = tr("%1 [installed]").arg(title);
|
||||
|
||||
painter->save();
|
||||
|
||||
auto font = opt.font;
|
||||
if (isChecked) {
|
||||
font.setBold(true);
|
||||
}
|
||||
if (isInstalled) {
|
||||
title = tr("%1 [installed]").arg(title);
|
||||
}
|
||||
|
||||
font.setPointSize(font.pointSize() + 2);
|
||||
painter->setFont(font);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue