diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index 583d2061ed4..468c7a51550 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -5320,9 +5320,9 @@ QSize QStyleSheetStyle::sizeFromContents(ContentsType ct, const QStyleOption *op #if QT_CONFIG(spinbox) case CT_SpinBox: if (const QStyleOptionSpinBox *spinbox = qstyleoption_cast(opt)) { - if (rule.baseStyleCanDraw()) - return baseStyle()->sizeFromContents(ct, opt, sz, w); - if (spinbox->buttonSymbols != QAbstractSpinBox::NoButtons) { + if (rule.baseStyleCanDraw()) { + sz = baseStyle()->sizeFromContents(ct, opt, sz, w); + } else if (spinbox->buttonSymbols != QAbstractSpinBox::NoButtons) { // Add some space for the up/down buttons QRenderRule subRule = renderRule(w, opt, PseudoElement_SpinBoxUpButton); if (subRule.hasDrawable()) {