From e0395cdbf733bd7c100c7cda0ffc7e085ed32774 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Fri, 20 Oct 2023 15:05:58 +0200 Subject: [PATCH] QFusionStyle: remove dead code from drawItemText() The !enabled branch does nothing so it can be safely removed. Also remove the unneeded documentation since it's a simple reimplementation from the base class. Change-Id: Iea6e77ab42b09a30f73ae2f1f671eb4198a31c41 Reviewed-by: Volker Hilsheimer --- src/widgets/styles/qfusionstyle.cpp | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp index c9b7ca9eee..5766c5089b 100644 --- a/src/widgets/styles/qfusionstyle.cpp +++ b/src/widgets/styles/qfusionstyle.cpp @@ -375,37 +375,18 @@ QFusionStyle::~QFusionStyle() } /*! - \fn void QFusionStyle::drawItemText(QPainter *painter, const QRect &rectangle, int alignment, const QPalette &palette, - bool enabled, const QString& text, QPalette::ColorRole textRole) const - - Draws the given \a text in the specified \a rectangle using the - provided \a painter and \a palette. - - Text is drawn using the painter's pen. If an explicit \a textRole - is specified, then the text is drawn using the \a palette's color - for the specified role. The \a enabled value indicates whether or - not the item is enabled; when reimplementing, this value should - influence how the item is drawn. - - The text is aligned and wrapped according to the specified \a - alignment. - - \sa Qt::Alignment + \reimp */ void QFusionStyle::drawItemText(QPainter *painter, const QRect &rect, int alignment, const QPalette &pal, bool enabled, const QString& text, QPalette::ColorRole textRole) const { + Q_UNUSED(enabled); if (text.isEmpty()) return; QPen savedPen = painter->pen(); - if (textRole != QPalette::NoRole) { + if (textRole != QPalette::NoRole) painter->setPen(QPen(pal.brush(textRole), savedPen.widthF())); - } - if (!enabled) { - QPen pen = painter->pen(); - painter->setPen(pen); - } painter->drawText(rect, alignment, text); painter->setPen(savedPen); }