From 40b80d37963e35e9427620c32b93913bd821bde5 Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Mon, 29 Jun 2020 17:06:46 +0000 Subject: [PATCH] optimize QStyle::itemTextRect() Signed-off-by: Ivailo Monev --- src/gui/styles/qstyle.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/gui/styles/qstyle.cpp b/src/gui/styles/qstyle.cpp index dab02b36e..6ab4278aa 100644 --- a/src/gui/styles/qstyle.cpp +++ b/src/gui/styles/qstyle.cpp @@ -448,17 +448,15 @@ void QStyle::polish(QPalette & /* pal */) QRect QStyle::itemTextRect(const QFontMetrics &metrics, const QRect &rect, int alignment, bool enabled, const QString &text) const { - int x, y, w, h; - rect.getRect(&x, &y, &w, &h); if (!text.isEmpty()) { - QRect result = metrics.boundingRect(x, y, w, h, alignment, text); + QRect result = metrics.boundingRect(rect.x(), rect.y(), rect.width(), rect.height(), alignment, text); if (!enabled && proxy()->styleHint(SH_EtchDisabledText)) { result.setWidth(result.width()+1); result.setHeight(result.height()+1); } return result; } - return QRect(x, y, w, h); + return rect; } /*!