diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> | 2017-08-02 11:39:01 +0200 |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> | 2017-12-08 15:06:32 +0000 |
commit | 4d88d79aa507777bce40740b21747f656efc074d (patch) | |
tree | 0b335cac61062eaf281b5a76514f8bd74bbcaaf2 /src/widgets/widgets/qabstractspinbox.cpp | |
parent | cd56e843cc53938111879c21570eaf8225719743 (diff) |
Update usage of QFontMetrics::width() to new API
QFontMetrics(F)::width() has been deprecated and is replaced by
horizontalAdvance(). This updates all usage of it in tests and
documentation.
It is worth noting that many or most of the usages of
QFontMetrics::width() probably intended to use boundingRect().width(),
but since it currently works, I have not looked into that, just
replaced the function name mechanically.
Change-Id: Iec382e5bad0b50f37a6cfff841bfb46ed4d4555f
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/widgets/widgets/qabstractspinbox.cpp')
-rw-r--r-- | src/widgets/widgets/qabstractspinbox.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/widgets/widgets/qabstractspinbox.cpp b/src/widgets/widgets/qabstractspinbox.cpp index 3427579d1f..61526916f1 100644 --- a/src/widgets/widgets/qabstractspinbox.cpp +++ b/src/widgets/widgets/qabstractspinbox.cpp @@ -870,15 +870,15 @@ QSize QAbstractSpinBox::sizeHint() const s = d->textFromValue(d->minimum); s.truncate(18); s += fixedContent; - w = qMax(w, fm.width(s)); + w = qMax(w, fm.horizontalAdvance(s)); s = d->textFromValue(d->maximum); s.truncate(18); s += fixedContent; - w = qMax(w, fm.width(s)); + w = qMax(w, fm.horizontalAdvance(s)); if (d->specialValueText.size()) { s = d->specialValueText; - w = qMax(w, fm.width(s)); + w = qMax(w, fm.horizontalAdvance(s)); } w += 2; // cursor blinking space @@ -911,15 +911,15 @@ QSize QAbstractSpinBox::minimumSizeHint() const s = d->textFromValue(d->minimum); s.truncate(18); s += fixedContent; - w = qMax(w, fm.width(s)); + w = qMax(w, fm.horizontalAdvance(s)); s = d->textFromValue(d->maximum); s.truncate(18); s += fixedContent; - w = qMax(w, fm.width(s)); + w = qMax(w, fm.horizontalAdvance(s)); if (d->specialValueText.size()) { s = d->specialValueText; - w = qMax(w, fm.width(s)); + w = qMax(w, fm.horizontalAdvance(s)); } w += 2; // cursor blinking space |