diff options
author | Eskil Abrahamsen Blomfeldt <[email protected]> | 2017-08-02 11:39:01 +0200 |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <[email protected]> | 2017-12-08 15:06:32 +0000 |
commit | 4d88d79aa507777bce40740b21747f656efc074d (patch) | |
tree | 0b335cac61062eaf281b5a76514f8bd74bbcaaf2 /src/gui/text/qtextlayout.cpp | |
parent | cd56e843cc53938111879c21570eaf8225719743 (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 <[email protected]>
Diffstat (limited to 'src/gui/text/qtextlayout.cpp')
-rw-r--r-- | src/gui/text/qtextlayout.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index 066f258ea35..bf267a0bbd5 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -2453,7 +2453,7 @@ void QTextLine::draw(QPainter *p, const QPointF &pos, const QTextLayout::FormatR const qreal lineHeight = line.height().toReal(); QRectF r(pos.x() + line.x.toReal(), pos.y() + line.y.toReal(), - lineHeight / 2, QFontMetrics(eng->font()).width(QLatin1Char(' '))); + lineHeight / 2, QFontMetrics(eng->font()).horizontalAdvance(QLatin1Char(' '))); setPenAndDrawBackground(p, QPen(), selection->format, r); p->setPen(pen); } @@ -2540,7 +2540,7 @@ void QTextLine::draw(QPainter *p, const QPointF &pos, const QTextLayout::FormatR QPainterPrivate::get(p)->drawTextItem(QPointF(iterator.x.toReal(), y.toReal()), gf, eng); if (eng->option.flags() & QTextOption::ShowTabsAndSpaces) { QChar visualTab(0x2192); - int w = QFontMetrics(f).width(visualTab); + int w = QFontMetrics(f).horizontalAdvance(visualTab); qreal x = iterator.itemWidth.toReal() - w; // Right-aligned if (x < 0) p->setClipRect(QRectF(iterator.x.toReal(), line.y.toReal(), |