Skip to content

Commit ccec2a9

Browse files
chehrlicQt Cherry-pick Bot
authored andcommitted
QStyleSheetStyle: properly handle up/down styles
Even when there is no rule for the complete QSpinBox, the handles could have a rule which should be honored. Pick-to: 6.8 Fixes: QTBUG-141916 Task-number: QTBUG-133845 Change-Id: I9411238b6d6aeaab51432b02bf66c97ca3b3b6af Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit 99f7979) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
1 parent 229eed8 commit ccec2a9

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/widgets/styles/qstylesheetstyle.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5277,12 +5277,8 @@ QSize QStyleSheetStyle::sizeFromContents(ContentsType ct, const QStyleOption *op
52775277
#if QT_CONFIG(spinbox)
52785278
case CT_SpinBox:
52795279
if (const QStyleOptionSpinBox *spinbox = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) {
5280-
if (rule.baseStyleCanDraw()) {
5280+
if (rule.baseStyleCanDraw())
52815281
sz = baseStyle()->sizeFromContents(ct, opt, sz, w);
5282-
if (rule.hasBox() || !rule.hasNativeBorder())
5283-
sz = rule.boxSize(sz);
5284-
return sz;
5285-
}
52865282
if (spinbox->buttonSymbols != QAbstractSpinBox::NoButtons) {
52875283
// Add some space for the up/down buttons
52885284
QRenderRule subRule = renderRule(w, opt, PseudoElement_SpinBoxUpButton);
@@ -5295,7 +5291,8 @@ QSize QStyleSheetStyle::sizeFromContents(ContentsType ct, const QStyleOption *op
52955291
sz.rwidth() += defaultUpSize.width();
52965292
}
52975293
}
5298-
if (rule.hasBox() || rule.hasBorder() || !rule.hasNativeBorder())
5294+
const bool honorBorder = !rule.baseStyleCanDraw() && rule.hasBorder();
5295+
if (rule.hasBox() || honorBorder || !rule.hasNativeBorder())
52995296
sz = rule.boxSize(sz);
53005297
return sz;
53015298
}

0 commit comments

Comments
 (0)