Windows11Style: make QPushButton a little bit wider

The spacing betwen the border and text in a QPushButton is a little bit
to small because the CE_PushButtonBevel is drawn with 4px less than the
size hint due to the rounded border. Therefore add the 4px for
CT_PushButton.

Pick-to: 6.9 6.8
Fixes: QTBUG-126515
Change-Id: Ie64225ad4734399b5da8bc4e73738592f32a7982
Reviewed-by: Wladimir Leuschner <wladimir.leuschner@qt.io>
This commit is contained in:
Christian Ehrlicher 2025-04-27 20:13:39 +02:00
parent 834d92a7ad
commit d205844e51

View File

@ -2144,6 +2144,11 @@ QSize QWindows11Style::sizeFromContents(ContentsType type, const QStyleOption *o
if (size.width() == 0)
contentSize.rwidth() += 2;
break;
case CT_PushButton:
contentSize = QWindowsVistaStyle::sizeFromContents(type, option, size, widget);
contentSize.rwidth() += 2 * 2; // the CE_PushButtonBevel draws a rounded rect with
// QMargins(2, 2, 2, 2) removed
break;
default:
contentSize = QWindowsVistaStyle::sizeFromContents(type, option, size, widget);
break;