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 <jpnurmi@digia.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
This commit is contained in:
Jens Bache-Wiig 2014-03-31 16:42:56 +02:00 committed by The Qt Project
parent 9cfdd66b64
commit 112b8e49c2

View File

@ -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;
}