QCommonStyle: fetch flat property from style option

The same information is available both from the QGroupBox API and from
the QStyleOption; we should prefer the latter, because this makes it
easier to use QStyle from QQuick.Controls (where a QGroupBox is not
instantiated).

Change-Id: I05ed1e3406676bde5d124d395d43caa0961c4f2d
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
This commit is contained in:
Alberto Mardegan 2018-12-08 09:13:32 +03:00
parent e56c79dc9d
commit 9ee29b826c

View File

@ -4921,8 +4921,8 @@ QSize QCommonStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
break; break;
#if QT_CONFIG(groupbox) #if QT_CONFIG(groupbox)
case CT_GroupBox: case CT_GroupBox:
if (const QGroupBox *grb = static_cast<const QGroupBox *>(widget)) if (const QStyleOptionGroupBox *styleOpt = qstyleoption_cast<const QStyleOptionGroupBox *>(opt))
sz += QSize(!grb->isFlat() ? 16 : 0, 0); sz += QSize(styleOpt->features.testFlag(QStyleOptionFrame::Flat) ? 0 : 16, 0);
break; break;
#endif // QT_CONFIG(groupbox) #endif // QT_CONFIG(groupbox)
case CT_MdiControls: case CT_MdiControls: