Skip to content

Commit

Permalink
QStyleSheetStyle: Honor box settings for QSpinBox
Browse files Browse the repository at this point in the history
The previous patch to not modify the CT_SpinBox by QStyleSheet when
nothing was added for QStylesheet also removed the additional margins &
paddings handling for the size calculation. This patch re-adds this.

This amends 96adebe.

Task-number: QTBUG-130642
Fixes: QTBUG-132431
Change-Id: Iff1f0febeca90d3154e61fd80e4b359bc7766b84
Reviewed-by: Volker Hilsheimer <[email protected]>
Reviewed-by: Axel Spoerl <[email protected]>
(cherry picked from commit b2cc882)
Reviewed-by: Qt Cherry-pick Bot <[email protected]>
(cherry picked from commit e23933e)
  • Loading branch information
chehrlic authored and Qt Cherry-pick Bot committed Dec 29, 2024
1 parent bb81ac7 commit 75fd0f3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/widgets/styles/qstylesheetstyle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5299,9 +5299,9 @@ QSize QStyleSheetStyle::sizeFromContents(ContentsType ct, const QStyleOption *op
#if QT_CONFIG(spinbox)
case CT_SpinBox:
if (const QStyleOptionSpinBox *spinbox = qstyleoption_cast<const QStyleOptionSpinBox *>(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()) {
Expand Down

0 comments on commit 75fd0f3

Please sign in to comment.