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>
bb10
Jens Bache-Wiig 2013-06-11 14:50:55 +02:00 committed by The Qt Project
parent e3dadce470
commit 93c0de7253
1 changed files with 8 additions and 4 deletions

View File

@ -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)