From 112b8e49c291a2ee6a1d67dccf368e53c9bd19cd Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Mon, 31 Mar 2014 16:42:56 +0200 Subject: [PATCH] Fix widget margins on Mac with style sheets Previously we have rejected this issue as you can work around it by setting Qt::WA_LayoutUsesWidgetRect per widget. However there is no reason to apply the negative mac style layout margins on any custom style so I think we should completely bypass it unless the native border is used. Task-number: QTBUG-13050 Change-Id: I8923e07d868c51a13587993c9b2ce79c51beaeee Reviewed-by: J-P Nurmi Reviewed-by: Olivier Goffart --- src/widgets/styles/qstylesheetstyle.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index 5eea903773..a22d0a3dca 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -5805,6 +5805,25 @@ QRect QStyleSheetStyle::subElementRect(SubElement se, const QStyleOption *opt, c break; #endif //QT_NO_TOOLBAR + // On mac we make pixel adjustments to layouts which are not + // desireable when you have custom style sheets on them + case SE_CheckBoxLayoutItem: + case SE_ComboBoxLayoutItem: + case SE_DateTimeEditLayoutItem: + case SE_LabelLayoutItem: + case SE_ProgressBarLayoutItem: + case SE_PushButtonLayoutItem: + case SE_RadioButtonLayoutItem: + case SE_SliderLayoutItem: + case SE_SpinBoxLayoutItem: + case SE_ToolButtonLayoutItem: + case SE_FrameLayoutItem: + case SE_GroupBoxLayoutItem: + case SE_TabWidgetLayoutItem: + if (!rule.hasNativeBorder()) + return opt->rect; + break; + default: break; }