Windows11Style: adjust size of flat buttons

Flat buttons were larger than normal buttons - therefore also add
marginsRemove(QMargins(2,2,2,2) for the flat case too.

Pick-to: 6.8
Task-number: QTBUG-132433
Change-Id: Id010d45bf85c5d7d09ff8db8bda44b1be7d85297
Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io>
(cherry picked from commit a930fb758d71ef6bf353e8fd8078de2335c32085)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Christian Ehrlicher 2024-12-23 18:23:03 +01:00 committed by Qt Cherry-pick Bot
parent 936992c404
commit b7e0a7bfde

View File

@ -1433,8 +1433,9 @@ void QWindows11Style::drawControl(ControlElement element, const QStyleOption *op
break;
case CE_PushButtonBevel:
if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option)) {
QRectF rect = btn->rect.marginsRemoved(QMargins(2, 2, 2, 2));
painter->setPen(Qt::NoPen);
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)) {
@ -1445,8 +1446,6 @@ void QWindows11Style::drawControl(ControlElement element, const QStyleOption *op
}
painter->drawRoundedRect(rect, secondLevelRoundingRadius, secondLevelRoundingRadius);
} else {
QRectF rect = btn->rect.marginsRemoved(QMargins(2,2,2,2));
painter->setPen(Qt::NoPen);
if (flags & (State_Sunken))
painter->setBrush(flags & State_On ? option->palette.accent().color().lighter(120) : WINUI3Colors[colorSchemeIndex][controlFillTertiary]);
else if (flags & State_MouseOver)