diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> | 2022-09-08 12:26:03 +0200 |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> | 2022-09-08 15:38:06 +0200 |
commit | 817f307a18d28143a1e8234f3846d019589c9d7a (patch) | |
tree | bc5da8cb5f5e886a613f3ae28527aa9028802e21 /src/gui/doc/snippets/code | |
parent | 2585fa7c091715ba4766bf58a75ae8f632dbb37f (diff) |
doc: Clarify the term advance width
The QFontMetrics documentation has been wrongly stating that the
the horizontalAdvance() gives the width of a string, dating back
to when the function was misnamed as width(). This can cause issues
e.g. when using the value as input to eliding or clipping, since the
advance may be smaller than what is actually drawn.
This tries to clarify the term a bit.
Task-number: QTBUG-90036
Change-Id: I8ed82fa14fe26c2a20cdbee9f2097a0aa4cc3925
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
Diffstat (limited to 'src/gui/doc/snippets/code')
-rw-r--r-- | src/gui/doc/snippets/code/src_gui_text_qfontmetrics.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
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 33a82f8dd1..4650ad8d8f 100644 --- a/src/gui/doc/snippets/code/src_gui_text_qfontmetrics.cpp +++ b/src/gui/doc/snippets/code/src_gui_text_qfontmetrics.cpp @@ -9,7 +9,7 @@ void wrapper0() { //! [0] QFont font("times", 24); QFontMetrics fm(font); -int pixelsWide = fm.horizontalAdvance("What's the width of this text?"); +int pixelsWide = fm.horizontalAdvance("What's the advance width of this text?"); int pixelsHigh = fm.height(); //! [0] @@ -22,7 +22,7 @@ void wrapper1() { //! [1] QFont font("times", 24); QFontMetricsF fm(font); -qreal pixelsWide = fm.horizontalAdvance("What's the width of this text?"); +qreal pixelsWide = fm.horizontalAdvance("What's the advance width of this text?"); qreal pixelsHigh = fm.height(); //! [1] |