summaryrefslogtreecommitdiffstats
path: root/src/gui/doc
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2017-08-02 11:39:01 +0200
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2017-12-08 15:06:32 +0000
commit4d88d79aa507777bce40740b21747f656efc074d (patch)
tree0b335cac61062eaf281b5a76514f8bd74bbcaaf2 /src/gui/doc
parentcd56e843cc53938111879c21570eaf8225719743 (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/gui/doc')
-rw-r--r--src/gui/doc/snippets/code/src_gui_text_qfont.cpp2
-rw-r--r--src/gui/doc/snippets/code/src_gui_text_qfontmetrics.cpp4
2 files changed, 3 insertions, 3 deletions
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 82d8525ded..1901ca9b10 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 6cffa4f611..6b478d3297 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]