aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/nativestyle
diff options
context:
space:
mode:
authorJan Arve Sæther <jan-arve.saether@qt.io>2020-11-05 16:54:12 +0100
committerJan Arve Sæther <jan-arve.saether@qt.io>2020-11-06 08:33:15 +0100
commit75be525dc02ea0c2d6f4e0c07392451d2a43a3a1 (patch)
treea8244800a6753f0319f983c91dfe479a78e32256 /src/imports/nativestyle
parent3e5c7d1bc39be85c339af5347f538416b453517b (diff)
Native style/GroupBox: Add contentsMargins for GroupBox on Windows
QWindowsStyle did not add these margins because the layout did that. (It had a 9 pixel margin all around it) However, Qt Quick Controls2 expects that the contentPadding includes that margin. We therefore change the subControlRect implementation for (CC_GroupBox,SC_GroupBoxContents) to add those margins. Change-Id: I953a49340dc085716b4e9ecf736a5438e7cc4bbd Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'src/imports/nativestyle')
-rw-r--r--src/imports/nativestyle/qstyle/windows/qquickwindowsxpstyle.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/imports/nativestyle/qstyle/windows/qquickwindowsxpstyle.cpp b/src/imports/nativestyle/qstyle/windows/qquickwindowsxpstyle.cpp
index 91e475b4..f4defe49 100644
--- a/src/imports/nativestyle/qstyle/windows/qquickwindowsxpstyle.cpp
+++ b/src/imports/nativestyle/qstyle/windows/qquickwindowsxpstyle.cpp
@@ -3223,6 +3223,15 @@ QRect QWindowsXPStyle::subControlRect(ComplexControl cc, const QStyleOptionCompl
QRect rect;
switch (cc) {
+ case CC_GroupBox:
+ rect = visualRect(option->direction, option->rect,
+ QWindowsStyle::subControlRect(cc, option, subControl));
+ if (subControl == QStyle::SC_GroupBoxContents) {
+ // This will add the margins that was added by QLayouts in QtWidgets
+ // (default to 9 for layouts inside a QGroupBox)
+ rect.adjust(9, 9, -9, -9);
+ }
+ break;
case CC_TitleBar:
if (const QStyleOptionTitleBar *tb = qstyleoption_cast<const QStyleOptionTitleBar *>(option)) {
if (!buttonVisible(subControl, tb))