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 /tests/benchmarks | |
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 'tests/benchmarks')
3 files changed, 4 insertions, 4 deletions
diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/button.cpp b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/button.cpp index f7701d9f7f..b8bd55789d 100644 --- a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/button.cpp +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/button.cpp @@ -123,7 +123,7 @@ QSizeF Button::sizeHint(Qt::SizeHint which, case Qt::PreferredSize: { QFontMetricsF fm(d->textItem->font()); - return QSizeF(fm.width(d->textItem->text()), fm.height()); + return QSizeF(fm.horizontalAdvance(d->textItem->text()), fm.height()); } default: return QGraphicsWidget::sizeHint(which, constraint); diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/label.cpp b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/label.cpp index 7b0dcd5afa..5fb2ee1a51 100644 --- a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/label.cpp +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/label.cpp @@ -73,7 +73,7 @@ QSizeF Label::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const // fall thru case Qt::PreferredSize: { QFontMetricsF fm(m_textItem->font()); - return QSizeF(fm.width(m_textItem->text()), fm.height()); + return QSizeF(fm.horizontalAdvance(m_textItem->text()), fm.height()); } default: return GvbWidget::sizeHint(which, constraint); diff --git a/tests/benchmarks/gui/painting/qtbench/benchmarktests.h b/tests/benchmarks/gui/painting/qtbench/benchmarktests.h index 42b06778f9..b31b6823aa 100644 --- a/tests/benchmarks/gui/painting/qtbench/benchmarktests.h +++ b/tests/benchmarks/gui/painting/qtbench/benchmarktests.h @@ -544,13 +544,13 @@ public: m_staticTexts.append(staticText); QFontMetrics fm(p->font()); - m_size = QSize(fm.width(m_text, m_text.length()), fm.height()); + m_size = QSize(fm.horizontalAdvance(m_text, m_text.length()), fm.height()); break; } case PainterQPointMode: { QFontMetrics fm(p->font()); - m_size = QSize(fm.width(m_text, m_text.length()), fm.height()); + m_size = QSize(fm.horizontalAdvance(m_text, m_text.length()), fm.height()); break; } |