Revert "QCommonStyle::pixelMetric(): Silence warnings about deprecated enum values"

This reverts commit 82a39f12fa.

Reason for revert: Breaks the 5.15 -> dev merge. Failing tests appear
in tst_qgridlayout.

Change-Id: Ic251df6e06f5505de37376a6b15249762cba5307
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This commit is contained in:
Fabian Kosmale 2020-04-08 09:59:34 +00:00
parent 34adcabc6c
commit 14c55e2979

View File

@ -4498,21 +4498,6 @@ QRect QCommonStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex
return ret;
}
static inline int defaultLayoutTopMargin(const QStyleOption *opt)
{
return int(QStyleHelper::dpiScaled(11, opt));
}
static inline int defaultLayoutChildMargin(const QStyleOption *opt)
{
return int(QStyleHelper::dpiScaled(9, opt));
}
static inline int defaultLayoutSpacing(const QStyleOption *opt)
{
return int(QStyleHelper::dpiScaled(6, opt));
}
/*! \reimp */
int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWidget *widget) const
{
@ -4791,44 +4776,28 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid
case PM_LayoutBottomMargin:
{
bool isWindow = false;
if (opt)
isWindow = opt->state.testFlag(State_Window);
else if (widget)
if (opt) {
isWindow = (opt->state & State_Window);
} else if (widget) {
isWindow = widget->isWindow();
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
ret = isWindow ? defaultLayoutTopMargin(opt) : defaultLayoutChildMargin(opt);
#else
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
}
ret = proxy()->pixelMetric(isWindow ? PM_DefaultTopLevelMargin : PM_DefaultChildMargin, opt);
QT_WARNING_POP
#endif
}
break;
case PM_LayoutHorizontalSpacing:
case PM_LayoutVerticalSpacing:
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
ret = defaultLayoutTopMargin(opt);
#else
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
ret = proxy()->pixelMetric(PM_DefaultLayoutSpacing, opt);
QT_WARNING_POP
#endif
break;
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
case PM_DefaultTopLevelMargin:
ret = defaultLayoutTopMargin(opt);
ret = int(QStyleHelper::dpiScaled(11, opt));
break;
case PM_DefaultChildMargin:
ret = defaultLayoutChildMargin(opt);
ret = int(QStyleHelper::dpiScaled(9, opt));
break;
case PM_DefaultLayoutSpacing:
ret = defaultLayoutSpacing(opt);
ret = int(QStyleHelper::dpiScaled(6, opt));
break;
QT_WARNING_POP
case PM_ToolBarIconSize:
ret = 0;