QDoubleSpinBox: Set back an upper limit width

The limit has been removed in the change
a317ee0a6f.

Task-number: QTBUG-44865
Change-Id: I7106f7e7a2653e1ab03d79861ac505d4666598eb
Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
bb10
Caroline Chao 2015-03-09 15:16:28 +01:00
parent f2ec2fcd55
commit 05e073deeb
2 changed files with 16 additions and 4 deletions

View File

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

View File

@ -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}
*/