From 33eb9811016edcfdaa5f4c7805db707c7a94e66c Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Fri, 21 Mar 2025 22:20:58 +0100 Subject: [PATCH] Windows11Style: don't draw progressbar label for vertical progressbars Since the label of a progressbar is drawn right of the bar, it does not make sense to draw a label for vertical bars. This is consistent with windows and windowsvista style. Pick-to: 6.8 Fixes: QTBUG-132459 Change-Id: I6610a1ef1b4074a6301aac12928c1dfe99ffd457 Reviewed-by: Wladimir Leuschner (cherry picked from commit a37606310e397e13dba223dc858555c9f26ce9b6) Reviewed-by: Qt Cherry-pick Bot --- src/plugins/styles/modernwindows/qwindows11style.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/plugins/styles/modernwindows/qwindows11style.cpp b/src/plugins/styles/modernwindows/qwindows11style.cpp index b5a82e4dc47..89d53c2b001 100644 --- a/src/plugins/styles/modernwindows/qwindows11style.cpp +++ b/src/plugins/styles/modernwindows/qwindows11style.cpp @@ -1373,9 +1373,12 @@ void QWindows11Style::drawControl(ControlElement element, const QStyleOption *op break; case QStyle::CE_ProgressBarLabel: if (const QStyleOptionProgressBar* progbaropt = qstyleoption_cast(option)) { - QRect rect = subElementRect(SE_ProgressBarLabel, progbaropt, widget); - painter->setPen(progbaropt->palette.text().color()); - painter->drawText(rect, progbaropt->text,progbaropt->textAlignment); + const bool vertical = !(progbaropt->state & QStyle::State_Horizontal); + if (!vertical) { + QRect rect = subElementRect(SE_ProgressBarLabel, progbaropt, widget); + painter->setPen(progbaropt->palette.text().color()); + painter->drawText(rect, progbaropt->text, progbaropt->textAlignment); + } } break; case CE_PushButtonLabel: