From 4d88d79aa507777bce40740b21747f656efc074d Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Wed, 2 Aug 2017 11:39:01 +0200 Subject: 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 --- examples/widgets/widgets/wiggly/wigglywidget.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'examples/widgets/widgets/wiggly/wigglywidget.cpp') diff --git a/examples/widgets/widgets/wiggly/wigglywidget.cpp b/examples/widgets/widgets/wiggly/wigglywidget.cpp index 9dfd43ff77..1b8f3cffad 100644 --- a/examples/widgets/widgets/wiggly/wigglywidget.cpp +++ b/examples/widgets/widgets/wiggly/wigglywidget.cpp @@ -77,7 +77,7 @@ void WigglyWidget::paintEvent(QPaintEvent * /* event */) }; QFontMetrics metrics(font()); - int x = (width() - metrics.width(text)) / 2; + int x = (width() - metrics.horizontalAdvance(text)) / 2; int y = (height() + metrics.ascent() - metrics.descent()) / 2; QColor color; //! [2] @@ -91,7 +91,7 @@ void WigglyWidget::paintEvent(QPaintEvent * /* event */) painter.setPen(color); painter.drawText(x, y - ((sineTable[index] * metrics.height()) / 400), QString(text[i])); - x += metrics.width(text[i]); + x += metrics.horizontalAdvance(text[i]); } } //! [4] -- cgit v1.2.3