diff options
author | Jens Bache-Wiig <jens.bache-wiig@digia.com> | 2013-06-11 14:50:55 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-06-19 06:21:32 +0200 |
commit | 93c0de7253e79c1510f6c761c1fc7bdfa2d87658 (patch) | |
tree | 1caf905af6e5bc12c1d37b398a01e1504d2708d0 /src/widgets | |
parent | e3dadce470bcc020dc11331be1877a10e70786a6 (diff) |
Fix QSpinBox clipping issue on Mac when frame=false
This was a regression from 5.0. Since we still require a minimum
height to be present in order for the spin buttons to draw correctly,
we require the same height from a spinbox without a frame as one
with a frame.
task-number: QTBUG-31538
Change-Id: I999f59a29e826e8e621faebffce9cccd9bedb8ca
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/styles/qmacstyle_mac.mm | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index 3daa696155..f8905b1b1a 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -6033,10 +6033,14 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, bool useAquaGuideline = true; switch (ct) { - case QStyle::CT_SpinBox: - // hack to work around horrible sizeHint() code in QAbstractSpinBox - sz = QCommonStyle::sizeFromContents(ct, opt, csz, widget); - sz.setHeight(sz.height() - 3); + + case CT_SpinBox: + if (const QStyleOptionSpinBox *vopt = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) { + // Add button + frame widths + int buttonWidth = 20; + int fw = proxy()->pixelMetric(PM_SpinBoxFrameWidth, vopt, widget); + sz += QSize(buttonWidth + 2*fw, 2*fw - 3); + } break; case QStyle::CT_TabWidget: // the size between the pane and the "contentsRect" (+4,+4) |