diff options
Diffstat (limited to 'src/widgets/styles')
-rw-r--r-- | src/widgets/styles/qcommonstyle.cpp | 2 | ||||
-rw-r--r-- | src/widgets/styles/qfusionstyle.cpp | 4 | ||||
-rw-r--r-- | src/widgets/styles/qstylesheetstyle.cpp | 4 | ||||
-rw-r--r-- | src/widgets/styles/qwindowsstyle.cpp | 2 |
4 files changed, 6 insertions, 6 deletions
diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp index 0ad508afd2..1155257664 100644 --- a/src/widgets/styles/qcommonstyle.cpp +++ b/src/widgets/styles/qcommonstyle.cpp @@ -2499,7 +2499,7 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt, const bool vertical = pb->orientation == Qt::Vertical; if (!vertical) { if (pb->textVisible) - textw = qMax(pb->fontMetrics.width(pb->text), pb->fontMetrics.width(QLatin1String("100%"))) + 6; + textw = qMax(pb->fontMetrics.horizontalAdvance(pb->text), pb->fontMetrics.horizontalAdvance(QLatin1String("100%"))) + 6; } if ((pb->textAlignment & Qt::AlignCenter) == 0) { diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp index e002b49d25..c01fb9e0db 100644 --- a/src/widgets/styles/qfusionstyle.cpp +++ b/src/widgets/styles/qfusionstyle.cpp @@ -1536,7 +1536,7 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio proxy()->drawItemText(painter, menuItem->rect.adjusted(margin, 0, -margin, 0), Qt::AlignLeft | Qt::AlignVCenter, menuItem->palette, menuItem->state & State_Enabled, menuItem->text, QPalette::Text); - w = menuItem->fontMetrics.width(menuItem->text) + margin; + w = menuItem->fontMetrics.horizontalAdvance(menuItem->text) + margin; } painter->setPen(shadow.lighter(106)); bool reverse = menuItem->direction == Qt::RightToLeft; @@ -3216,7 +3216,7 @@ QSize QFusionStyle::sizeFromContents(ContentsType type, const QStyleOption *opti QFont fontBold = menuItem->font; fontBold.setBold(true); QFontMetrics fmBold(fontBold); - w += fmBold.width(menuItem->text) - fm.width(menuItem->text); + w += fmBold.width(menuItem->text) - fm.horizontalAdvance(menuItem->text); } const int checkcol = qMax<int>(maxpmw, QStyleHelper::dpiScaled(QFusionStylePrivate::menuCheckMarkWidth)); // Windows always shows a check column w += checkcol; diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index fd812d8d0d..4e4576940a 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -833,7 +833,7 @@ QHash<QStyle::SubControl, QRect> QStyleSheetStyle::titleBarLayout(const QWidget continue; } if (info.element == PseudoElement_TitleBar) { - info.width = tb->fontMetrics.width(tb->text) + 6; + info.width = tb->fontMetrics.horizontalAdvance(tb->text) + 6; subRule.geo = new QStyleSheetGeometryData(info.width, tb->fontMetrics.height(), -1, -1, -1, -1); } else { subRule = renderRule(w, tb, info.element); @@ -5485,7 +5485,7 @@ QRect QStyleSheetStyle::subControlRect(ComplexControl cc, const QStyleOptionComp groupBox.rect = rule.borderRect(opt->rect); return baseStyle()->subControlRect(cc, &groupBox, sc, w); } - int tw = opt->fontMetrics.width(gb->text); + int tw = opt->fontMetrics.horizontalAdvance(gb->text); int th = opt->fontMetrics.height(); int spacing = pixelMetric(QStyle::PM_CheckBoxLabelSpacing, opt, w); int iw = pixelMetric(QStyle::PM_IndicatorWidth, opt, w); diff --git a/src/widgets/styles/qwindowsstyle.cpp b/src/widgets/styles/qwindowsstyle.cpp index 9e53038348..7a84a4dcf8 100644 --- a/src/widgets/styles/qwindowsstyle.cpp +++ b/src/widgets/styles/qwindowsstyle.cpp @@ -2388,7 +2388,7 @@ QSize QWindowsStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, QFont fontBold = mi->font; fontBold.setBold(true); QFontMetrics fmBold(fontBold); - w += fmBold.width(mi->text) - fm.width(mi->text); + w += fmBold.horizontalAdvance(mi->text) - fm.horizontalAdvance(mi->text); } int checkcol = qMax<int>(maxpmw, QWindowsStylePrivate::windowsCheckMarkWidth); // Windows always shows a check column |