diff options
author | Caroline Chao <caroline.chao@theqtcompany.com> | 2015-03-09 15:16:28 +0100 |
---|---|---|
committer | Caroline Chao <caroline.chao@theqtcompany.com> | 2015-03-23 07:22:17 +0000 |
commit | 05e073deebfd38103f283f8698d47a6d4a76737e (patch) | |
tree | a1d4219a2e3674f4d3a1f477d5dc0b1c2250868f /src | |
parent | f2ec2fcd553955335b0795d26cb18c9fe2f58008 (diff) |
QDoubleSpinBox: Set back an upper limit width
The limit has been removed in the change
a317ee0a6fa76d1166f6da8593d39eaf7afce83c.
Task-number: QTBUG-44865
Change-Id: I7106f7e7a2653e1ab03d79861ac505d4666598eb
Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/widgets/widgets/qabstractspinbox.cpp | 17 | ||||
-rw-r--r-- | src/widgets/widgets/qspinbox.cpp | 3 |
2 files changed, 16 insertions, 4 deletions
diff --git a/src/widgets/widgets/qabstractspinbox.cpp b/src/widgets/widgets/qabstractspinbox.cpp index 2f833499d9..c96c779d6a 100644 --- a/src/widgets/widgets/qabstractspinbox.cpp +++ b/src/widgets/widgets/qabstractspinbox.cpp @@ -848,10 +848,15 @@ QSize QAbstractSpinBox::sizeHint() const int w = 0; QString s; QString fixedContent = d->prefix + d->suffix + QLatin1Char(' '); - s = d->textFromValue(d->minimum) + fixedContent; + s = d->textFromValue(d->minimum); + s.truncate(18); + s += fixedContent; w = qMax(w, fm.width(s)); - s = d->textFromValue(d->maximum) + fixedContent; + s = d->textFromValue(d->maximum); + s.truncate(18); + s += fixedContent; w = qMax(w, fm.width(s)); + if (d->specialValueText.size()) { s = d->specialValueText; w = qMax(w, fm.width(s)); @@ -884,9 +889,13 @@ QSize QAbstractSpinBox::minimumSizeHint() const QString s; QString fixedContent = d->prefix + QLatin1Char(' '); - s = d->textFromValue(d->minimum) + fixedContent; + s = d->textFromValue(d->minimum); + s.truncate(18); + s += fixedContent; w = qMax(w, fm.width(s)); - s = d->textFromValue(d->maximum) + fixedContent; + s = d->textFromValue(d->maximum); + s.truncate(18); + s += fixedContent; w = qMax(w, fm.width(s)); if (d->specialValueText.size()) { diff --git a/src/widgets/widgets/qspinbox.cpp b/src/widgets/widgets/qspinbox.cpp index 39f0b24307..457e2e1e4c 100644 --- a/src/widgets/widgets/qspinbox.cpp +++ b/src/widgets/widgets/qspinbox.cpp @@ -587,6 +587,9 @@ void QSpinBox::fixup(QString &input) const choice in addition to the range of numeric values. See setSpecialValueText() for how to do this with QDoubleSpinBox. + \note The displayed value of the QDoubleSpinBox is limited to 18 characters + in addition to eventual prefix and suffix content. This limitation is used + to keep the double spin box usable even with extremely large values. \sa QSpinBox, QDateTimeEdit, QSlider, {Spin Boxes Example} */ |