mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-11 20:43:25 -08:00
[Theme] Pass application palette when generating disabled icon pixmap
Co-authored-by: sentry[bot] <39604003+sentry[bot]@users.noreply.github.com>
This commit is contained in:
parent
16455c9fd5
commit
0bea891091
2 changed files with 34 additions and 1 deletions
|
|
@ -24,6 +24,7 @@
|
|||
#include <QString>
|
||||
#include <QStringLiteral>
|
||||
#include <QStyle>
|
||||
#include <QStyleOption>
|
||||
#include <QSvgRenderer>
|
||||
#include <QtGlobal>
|
||||
#include <utility>
|
||||
|
|
@ -318,7 +319,11 @@ private:
|
|||
}
|
||||
}
|
||||
if (mode == QIcon::Disabled && !pixmap.isNull()) {
|
||||
pixmap = QApplication::style()->generatedIconPixmap(QIcon::Disabled, pixmap, nullptr);
|
||||
// QCommonStyle reads the disabled colors from the option's palette
|
||||
// without a null check, so a null option crashes in QPalette::brush.
|
||||
QStyleOption option;
|
||||
option.palette = qApp->palette();
|
||||
pixmap = QApplication::style()->generatedIconPixmap(QIcon::Disabled, pixmap, &option);
|
||||
}
|
||||
return pixmap;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue