QWindows11Style: Respect background color for flat QPushButtons
Fixes: QTBUG-128781 Pick-to: 6.7 Change-Id: I634d42566ea6249b125da537ac7e60fbd8475635 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de> (cherry picked from commit 0b1275f630b5d03f314bc02879301df95b3f1940) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
f1bab31ff5
commit
6e6d42a3b3
@ -1433,6 +1433,8 @@ void QWindows11Style::drawControl(ControlElement element, const QStyleOption *op
|
||||
if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option)) {
|
||||
if (btn->features.testFlag(QStyleOptionButton::Flat)) {
|
||||
painter->setPen(Qt::NoPen);
|
||||
painter->setBrush(btn->palette.button());
|
||||
painter->drawRoundedRect(rect, secondLevelRoundingRadius, secondLevelRoundingRadius);
|
||||
if (flags & (State_Sunken | State_On)) {
|
||||
painter->setBrush(WINUI3Colors[colorSchemeIndex][subtlePressedColor]);
|
||||
}
|
||||
@ -2154,6 +2156,10 @@ void QWindows11Style::polish(QWidget* widget)
|
||||
} else if (widget->inherits("QAbstractButton") || widget->inherits("QToolButton")) {
|
||||
widget->setAutoFillBackground(false);
|
||||
auto pal = widget->palette();
|
||||
if (QPushButton *btn = qobject_cast<QPushButton*>(widget)) {
|
||||
if (btn->isFlat() && !pal.isBrushSet(QPalette::Active, QPalette::Button))
|
||||
pal.setColor(QPalette::Active, QPalette::Button, pal.window().color());
|
||||
}
|
||||
if (colorSchemeIndex == 0) {
|
||||
pal.setColor(QPalette::Disabled, QPalette::ButtonText, QColor(0x00,0x00,0x00,0x5C));
|
||||
pal.setColor(QPalette::Disabled, QPalette::Button, QColor(0xF9,0xF9,0xF9,0x4D));
|
||||
|
Loading…
x
Reference in New Issue
Block a user