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 --- tests/auto/other/qaccessibility/tst_qaccessibility.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'tests/auto/other/qaccessibility/tst_qaccessibility.cpp') diff --git a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp index 7976e0d626..b5d45adadb 100644 --- a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp @@ -1695,7 +1695,7 @@ static QRect characterRect(const QTextEdit &edit, int offset) ++it; QFontMetrics fm(it.fragment().charFormat().font()); QChar ch = edit.document()->characterAt(offset); - int w = fm.width(ch); + int w = fm.horizontalAdvance(ch); int h = fm.height(); qreal x = line.cursorToX(relativeOffset); @@ -1766,9 +1766,9 @@ void tst_QAccessibility::textEditTest() QCOMPARE(endOffset, 31); QCOMPARE(textIface->characterCount(), 48); QFontMetrics fm(edit.document()->defaultFont()); - QCOMPARE(textIface->characterRect(0).size(), QSize(fm.width("h"), fm.height())); - QCOMPARE(textIface->characterRect(5).size(), QSize(fm.width(" "), fm.height())); - QCOMPARE(textIface->characterRect(6).size(), QSize(fm.width("w"), fm.height())); + QCOMPARE(textIface->characterRect(0).size(), QSize(fm.horizontalAdvance("h"), fm.height())); + QCOMPARE(textIface->characterRect(5).size(), QSize(fm.horizontalAdvance(" "), fm.height())); + QCOMPARE(textIface->characterRect(6).size(), QSize(fm.horizontalAdvance("w"), fm.height())); int offset = 10; QCOMPARE(textIface->text(offset, offset + 1), QStringLiteral("d")); -- cgit v1.2.3