From 168f4aee268186f12f081ba962c6a25521556018 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Thu, 31 Oct 2024 18:37:23 +0100 Subject: [PATCH] QStyleSheetStyle: Don't calc size for CT_SpinBox when not handled Let the size for CT_SpinBox be calculated by the base style when QStyleSheetStyle does not draw the spinbox. This makes sure the returned size matches the size needed by the style which draws the spinbox later on. Fixes: QTBUG-130642 Change-Id: I99aca7440c4ce9800d78f76a209097a93f320cd2 Reviewed-by: Axel Spoerl (cherry picked from commit 96adebed606cdbc73c73778917d777dc04c6e93e) Reviewed-by: Qt Cherry-pick Bot --- src/widgets/styles/qstylesheetstyle.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index a1824a1df7b..d8b6f6fdfe2 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -5297,6 +5297,8 @@ 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) { // Add some space for the up/down buttons QRenderRule subRule = renderRule(w, opt, PseudoElement_SpinBoxUpButton);