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/statemachine/rogue/window.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'examples/widgets/statemachine/rogue') diff --git a/examples/widgets/statemachine/rogue/window.cpp b/examples/widgets/statemachine/rogue/window.cpp index 3515138382..059fbf1003 100644 --- a/examples/widgets/statemachine/rogue/window.cpp +++ b/examples/widgets/statemachine/rogue/window.cpp @@ -98,7 +98,7 @@ void Window::paintEvent(QPaintEvent * /* event */) QFontMetrics metrics(font()); QPainter painter(this); int fontHeight = metrics.height(); - int fontWidth = metrics.width('X'); + int fontWidth = metrics.horizontalAdvance('X'); int yPos = fontHeight; int xPos; @@ -177,7 +177,7 @@ QSize Window::sizeHint() const { QFontMetrics metrics(font()); - return QSize(metrics.width('X') * WIDTH, metrics.height() * (HEIGHT + 1)); + return QSize(metrics.horizontalAdvance('X') * WIDTH, metrics.height() * (HEIGHT + 1)); } //![2] -- cgit v1.2.3