summaryrefslogtreecommitdiffstats
path: root/src/widgets/styles/qmacstyle_mac.mm
diff options
context:
space:
mode:
authorCaroline Chao <caroline.chao@digia.com>2013-02-05 13:04:01 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-02-12 20:20:03 +0100
commita317ee0a6fa76d1166f6da8593d39eaf7afce83c (patch)
treeee653c08b70bee9a1eaccbad3b88f5fc2a786e45 /src/widgets/styles/qmacstyle_mac.mm
parent8f00f2020b37388ab309fdf39e85a3b3c9814e1d (diff)
Fix sizeHint for QAbstractSpinBox
The current size hint is not correct and the text is truncated when using prefix/suffix. Update QCommonStyle::sizeFromContents() to get the button and frame widths into account for the QSpinBox width. Update sizeFromContents() in the different styles to be consistent with the change in QCommonStyle. Update minimumSizeHint(), calculate it using the prefix and data range. The SpinBox can shrunk over the suffix if any. Task-number: QTBUG-28863 Change-Id: Ia742232edf8b11d0283e8136c2818928f8755103 Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
Diffstat (limited to 'src/widgets/styles/qmacstyle_mac.mm')
-rw-r--r--src/widgets/styles/qmacstyle_mac.mm5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm
index dddeb97f32..a58f6e710b 100644
--- a/src/widgets/styles/qmacstyle_mac.mm
+++ b/src/widgets/styles/qmacstyle_mac.mm
@@ -5985,10 +5985,11 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
switch (ct) {
case QStyle::CT_SpinBox:
- // hack to work around horrible sizeHint() code in QAbstractSpinBox
+ // hack to work around horrible sizeHint() code in QAbstractSpinBox
+ sz = QCommonStyle::sizeFromContents(ct, opt, csz, widget);
sz.setHeight(sz.height() - 3);
break;
- case QStyle::CT_TabWidget:
+ case QStyle::CT_TabWidget:
// the size between the pane and the "contentsRect" (+4,+4)
// (the "contentsRect" is on the inside of the pane)
sz = QCommonStyle::sizeFromContents(ct, opt, csz, widget);