mirror of
https://github.com/stenzek/duckstation.git
synced 2025-06-07 03:55:33 +00:00
Qt: Fix achievements text highlight colour
Was only really an issue in the Classic Windows theme I think.
This commit is contained in:
parent
426cdd1611
commit
836a0c7322
@ -1060,6 +1060,10 @@ public:
|
|||||||
painter->drawPixmap(r.topLeft() + QPoint(4, (r.height() - icon_height) / 2), icon);
|
painter->drawPixmap(r.topLeft() + QPoint(4, (r.height() - icon_height) / 2), icon);
|
||||||
r.setLeft(r.left() + 4 + icon.width());
|
r.setLeft(r.left() + 4 + icon.width());
|
||||||
|
|
||||||
|
const QPalette& palette = static_cast<QWidget*>(parent())->palette();
|
||||||
|
const QColor& text_color =
|
||||||
|
palette.color((option.state & QStyle::State_Selected) ? QPalette::HighlightedText : QPalette::Text);
|
||||||
|
|
||||||
if (num_achievements > 0)
|
if (num_achievements > 0)
|
||||||
{
|
{
|
||||||
const QFontMetrics fm(painter->fontMetrics());
|
const QFontMetrics fm(painter->fontMetrics());
|
||||||
@ -1071,10 +1075,9 @@ public:
|
|||||||
const QString first = QStringLiteral("%1").arg(display_hardcore_only ? num_unlocked_hardcore : num_unlocked);
|
const QString first = QStringLiteral("%1").arg(display_hardcore_only ? num_unlocked_hardcore : num_unlocked);
|
||||||
const QString total = QStringLiteral("/%3").arg(num_achievements);
|
const QString total = QStringLiteral("/%3").arg(num_achievements);
|
||||||
|
|
||||||
const QPalette& palette = static_cast<QWidget*>(parent())->palette();
|
|
||||||
const QColor hc_color = QColor(44, 151, 250);
|
const QColor hc_color = QColor(44, 151, 250);
|
||||||
|
|
||||||
painter->setPen(display_hardcore_only ? hc_color : palette.color(QPalette::WindowText));
|
painter->setPen(display_hardcore_only ? hc_color : text_color);
|
||||||
painter->drawText(r, Qt::AlignVCenter, first);
|
painter->drawText(r, Qt::AlignVCenter, first);
|
||||||
r.setLeft(r.left() + fm.size(Qt::TextSingleLine, first).width());
|
r.setLeft(r.left() + fm.size(Qt::TextSingleLine, first).width());
|
||||||
|
|
||||||
@ -1086,11 +1089,12 @@ public:
|
|||||||
r.setLeft(r.left() + fm.size(Qt::TextSingleLine, hc).width());
|
r.setLeft(r.left() + fm.size(Qt::TextSingleLine, hc).width());
|
||||||
}
|
}
|
||||||
|
|
||||||
painter->setPen(palette.color(QPalette::WindowText));
|
painter->setPen(text_color);
|
||||||
painter->drawText(r, Qt::AlignVCenter, total);
|
painter->drawText(r, Qt::AlignVCenter, total);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
painter->setPen(text_color);
|
||||||
painter->drawText(r, Qt::AlignVCenter, QStringLiteral("N/A"));
|
painter->drawText(r, Qt::AlignVCenter, QStringLiteral("N/A"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user