From d205844e51059c91395cf73ecd04ccc9382ff72c Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Sun, 27 Apr 2025 20:13:39 +0200 Subject: [PATCH] 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 --- src/plugins/styles/modernwindows/qwindows11style.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/plugins/styles/modernwindows/qwindows11style.cpp b/src/plugins/styles/modernwindows/qwindows11style.cpp index fd169745483..eb61957c768 100644 --- a/src/plugins/styles/modernwindows/qwindows11style.cpp +++ b/src/plugins/styles/modernwindows/qwindows11style.cpp @@ -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;