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 --- src/gui/doc/snippets/code/src_gui_text_qfont.cpp | 2 +- src/gui/doc/snippets/code/src_gui_text_qfontmetrics.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/gui/doc/snippets/code') diff --git a/src/gui/doc/snippets/code/src_gui_text_qfont.cpp b/src/gui/doc/snippets/code/src_gui_text_qfont.cpp index 82d8525ded0..1901ca9b10a 100644 --- a/src/gui/doc/snippets/code/src_gui_text_qfont.cpp +++ b/src/gui/doc/snippets/code/src_gui_text_qfont.cpp @@ -72,6 +72,6 @@ QString family = info.family(); //! [4] QFontMetrics fm(f1); -int textWidthInPixels = fm.width("How many pixels wide is this text?"); +int textWidthInPixels = fm.horizontalAdvance("How many pixels wide is this text?"); int textHeightInPixels = fm.height(); //! [4] diff --git a/src/gui/doc/snippets/code/src_gui_text_qfontmetrics.cpp b/src/gui/doc/snippets/code/src_gui_text_qfontmetrics.cpp index 6cffa4f611e..6b478d32979 100644 --- a/src/gui/doc/snippets/code/src_gui_text_qfontmetrics.cpp +++ b/src/gui/doc/snippets/code/src_gui_text_qfontmetrics.cpp @@ -51,7 +51,7 @@ //! [0] QFont font("times", 24); QFontMetrics fm(font); -int pixelsWide = fm.width("What's the width of this text?"); +int pixelsWide = fm.horizontalAdvance("What's the width of this text?"); int pixelsHigh = fm.height(); //! [0] @@ -59,6 +59,6 @@ int pixelsHigh = fm.height(); //! [1] QFont font("times", 24); QFontMetricsF fm(font); -qreal pixelsWide = fm.width("What's the width of this text?"); +qreal pixelsWide = fm.horizontalAdvance("What's the width of this text?"); qreal pixelsHigh = fm.height(); //! [1] -- cgit v1.2.3