diff options
Diffstat (limited to 'src/imports/nativestyle/qstyle')
-rw-r--r-- | src/imports/nativestyle/qstyle/qquickcommonstyle.cpp | 16 | ||||
-rw-r--r-- | src/imports/nativestyle/qstyle/windows/qquickwindowsxpstyle.cpp | 8 |
2 files changed, 11 insertions, 13 deletions
diff --git a/src/imports/nativestyle/qstyle/qquickcommonstyle.cpp b/src/imports/nativestyle/qstyle/qquickcommonstyle.cpp index 6e662e3d..45f23f05 100644 --- a/src/imports/nativestyle/qstyle/qquickcommonstyle.cpp +++ b/src/imports/nativestyle/qstyle/qquickcommonstyle.cpp @@ -4652,11 +4652,17 @@ QSize QCommonStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, c case CT_SpinBox: if (const QStyleOptionSpinBox *vopt = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) { // Add button + frame widths - const qreal dpi = QStyleHelper::dpi(opt); - const bool hasButtons = (vopt->buttonSymbols != QStyleOptionSpinBox::NoButtons); - const int buttonWidth = hasButtons ? qRound(QStyleHelper::dpiScaled(16, dpi)) : 0; - const int fw = vopt->frame ? proxy()->pixelMetric(PM_SpinBoxFrameWidth, vopt) : 0; - sz += QSize(buttonWidth + 2*fw, 2*fw); + if (vopt->subControls == SC_SpinBoxFrame) { + const qreal dpi = QStyleHelper::dpi(opt); + const bool hasButtons = (vopt->buttonSymbols != QStyleOptionSpinBox::NoButtons); + const int buttonWidth = hasButtons ? qRound(QStyleHelper::dpiScaled(16, dpi)) : 0; + const int fw = vopt->frame ? proxy()->pixelMetric(PM_SpinBoxFrameWidth, vopt) : 0; + sz += QSize(buttonWidth + 2*fw, 1 + 2*fw); + } else { + const QSize buttonSize = proxy()->subControlRect(CC_SpinBox, vopt, SC_SpinBoxUp).size(); + const int upAndDownTogetherHeight = buttonSize.height() * 2; + sz += QSize(buttonSize.width(), upAndDownTogetherHeight); + } } break; case CT_Slider: diff --git a/src/imports/nativestyle/qstyle/windows/qquickwindowsxpstyle.cpp b/src/imports/nativestyle/qstyle/windows/qquickwindowsxpstyle.cpp index d736f832..69180c62 100644 --- a/src/imports/nativestyle/qstyle/windows/qquickwindowsxpstyle.cpp +++ b/src/imports/nativestyle/qstyle/windows/qquickwindowsxpstyle.cpp @@ -3406,14 +3406,6 @@ QSize QWindowsXPStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt } } break; - case CT_SpinBox: - { - //Spinbox adds frame twice - sz = QWindowsStyle::sizeFromContents(ct, option, contentsSize); - int border = proxy()->pixelMetric(PM_SpinBoxFrameWidth, option); - sz -= QSize(2*border, 2*border); - } - break; case CT_TabWidget: sz += QSize(6, 6); break; |