From 9ee29b826c20bf554563a7495ec2ab8ef636032a Mon Sep 17 00:00:00 2001 From: Alberto Mardegan Date: Sat, 8 Dec 2018 09:13:32 +0300 Subject: [PATCH] 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 --- src/widgets/styles/qcommonstyle.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp index 9aec4f3aa49..fc48a8ca26d 100644 --- a/src/widgets/styles/qcommonstyle.cpp +++ b/src/widgets/styles/qcommonstyle.cpp @@ -4921,8 +4921,8 @@ QSize QCommonStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, break; #if QT_CONFIG(groupbox) case CT_GroupBox: - if (const QGroupBox *grb = static_cast(widget)) - sz += QSize(!grb->isFlat() ? 16 : 0, 0); + if (const QStyleOptionGroupBox *styleOpt = qstyleoption_cast(opt)) + sz += QSize(styleOpt->features.testFlag(QStyleOptionFrame::Flat) ? 0 : 16, 0); break; #endif // QT_CONFIG(groupbox) case CT_MdiControls: