summaryrefslogtreecommitdiffstats
path: root/src/widgets/doc/snippets/javastyle.cpp
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <[email protected]>2017-08-02 11:39:01 +0200
committerEskil Abrahamsen Blomfeldt <[email protected]>2017-12-08 15:06:32 +0000
commit4d88d79aa507777bce40740b21747f656efc074d (patch)
tree0b335cac61062eaf281b5a76514f8bd74bbcaaf2 /src/widgets/doc/snippets/javastyle.cpp
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 <[email protected]>
Diffstat (limited to 'src/widgets/doc/snippets/javastyle.cpp')
-rw-r--r--src/widgets/doc/snippets/javastyle.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/widgets/doc/snippets/javastyle.cpp b/src/widgets/doc/snippets/javastyle.cpp
index bddc303f710..8657d5ed292 100644
--- a/src/widgets/doc/snippets/javastyle.cpp
+++ b/src/widgets/doc/snippets/javastyle.cpp
@@ -214,7 +214,7 @@ void JavaStyle::drawControl(ControlElement control, const QStyleOption *option,
painter->translate(box->rect.width(), -box->rect.height());
}
- int textWidth = box->fontMetrics.width(box->text) + 20;
+ int textWidth = box->fontMetrics.horizontalAdvance(box->text) + 20;
QPolygon innerLine;
innerLine << (box->rect.topLeft() + QPoint(0, 1)) <<
@@ -1016,7 +1016,7 @@ void JavaStyle::drawControl(ControlElement control, const QStyleOption *option,
int h = pixmap.height();
if (!button->text.isEmpty())
- w += button->fontMetrics.width(button->text) + 2;
+ w += button->fontMetrics.horizontalAdvance(button->text) + 2;
point = QPoint(ir.x() + ir.width() / 2 - w / 2,
ir.y() + ir.height() / 2 - h / 2);
@@ -2453,7 +2453,7 @@ QRect JavaStyle::subElementRect(SubElement element,
rect.moveTopLeft(box->rect.topLeft() + QPoint(0, 2));
rect.setHeight(box->rect.height() - 4);
- rect.setWidth(box->fontMetrics.width(box->text) + 15);
+ rect.setWidth(box->fontMetrics.horizontalAdvance(box->text) + 15);
break;
}
case SE_ProgressBarLabel:
@@ -2467,7 +2467,7 @@ QRect JavaStyle::subElementRect(SubElement element,
qstyleoption_cast<const QStyleOptionButton *>(option);
rect = btn->fontMetrics.boundingRect(btn->text);
- rect = QRect(0, 0, btn->fontMetrics.width(btn->text),
+ rect = QRect(0, 0, btn->fontMetrics.horizontalAdvance(btn->text),
rect.height());
if (!btn->icon.isNull()) {