summaryrefslogtreecommitdiffstats
path: root/src/widgets/accessible
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/widgets/accessible
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/widgets/accessible')
-rw-r--r--src/widgets/accessible/qaccessiblewidgets.cpp2
-rw-r--r--src/widgets/accessible/simplewidgets.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/widgets/accessible/qaccessiblewidgets.cpp b/src/widgets/accessible/qaccessiblewidgets.cpp
index f869ab1129..872ddcded5 100644
--- a/src/widgets/accessible/qaccessiblewidgets.cpp
+++ b/src/widgets/accessible/qaccessiblewidgets.cpp
@@ -716,7 +716,7 @@ QRect QAccessibleTextWidget::characterRect(int offset) const
QFontMetrics fm(format.font());
const QString ch = text(offset, offset + 1);
if (!ch.isEmpty()) {
- int w = fm.width(ch);
+ int w = fm.horizontalAdvance(ch);
int h = fm.height();
r = QRect(layoutPosition.x() + x, layoutPosition.y() + line.y() + line.ascent() + fm.descent() - h,
w, h);
diff --git a/src/widgets/accessible/simplewidgets.cpp b/src/widgets/accessible/simplewidgets.cpp
index f821c2f001..f0423ca825 100644
--- a/src/widgets/accessible/simplewidgets.cpp
+++ b/src/widgets/accessible/simplewidgets.cpp
@@ -777,7 +777,7 @@ QRect QAccessibleLineEdit::characterRect(int offset) const
const QString ch = text(offset, offset + 1);
if (ch.isEmpty())
return QRect();
- int w = fm.width(ch);
+ int w = fm.horizontalAdvance(ch);
int h = fm.height();
QRect r(x, y, w, h);
r.moveTo(lineEdit()->mapToGlobal(r.topLeft()));