diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> | 2017-08-02 11:39:01 +0200 |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> | 2017-12-08 15:06:32 +0000 |
commit | 4d88d79aa507777bce40740b21747f656efc074d (patch) | |
tree | 0b335cac61062eaf281b5a76514f8bd74bbcaaf2 /src/plugins/styles | |
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 <lars.knoll@qt.io>
Diffstat (limited to 'src/plugins/styles')
-rw-r--r-- | src/plugins/styles/mac/qmacstyle_mac.mm | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/plugins/styles/mac/qmacstyle_mac.mm b/src/plugins/styles/mac/qmacstyle_mac.mm index 2067c86023..4eb63a1cff 100644 --- a/src/plugins/styles/mac/qmacstyle_mac.mm +++ b/src/plugins/styles/mac/qmacstyle_mac.mm @@ -921,7 +921,7 @@ static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QWidget *widg height = qMax(height, qMax(iconSize.height(), pmSize.height())); } if (!bt->text().isNull() && bt->toolButtonStyle() != Qt::ToolButtonIconOnly) { - int text_width = bt->fontMetrics().width(bt->text()), + int text_width = bt->fontMetrics().horizontalAdvance(bt->text()), text_height = bt->fontMetrics().height(); if (bt->toolButtonStyle() == Qt::ToolButtonTextUnderIcon) { width = qMax(width, text_width); @@ -5516,10 +5516,10 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex QRect br = p->clipRegion().boundingRect(); int x = br.x(), y = br.y() + (titlebar->rect.height() / 2 - p->fontMetrics().height() / 2); - if (br.width() <= (p->fontMetrics().width(titlebar->text) + iw * 2)) + if (br.width() <= (p->fontMetrics().horizontalAdvance(titlebar->text) + iw * 2)) x += iw; else - x += br.width() / 2 - p->fontMetrics().width(titlebar->text) / 2; + x += br.width() / 2 - p->fontMetrics().horizontalAdvance(titlebar->text) / 2; if (iw) { int iconExtent = proxy()->pixelMetric(PM_SmallIconSize); p->drawPixmap(x - iw, y, |