From 5e4b33f39d69223721a5c2ea963f51ab50228ce2 Mon Sep 17 00:00:00 2001 From: Wladimir Leuschner Date: Tue, 17 Dec 2024 15:13:16 +0100 Subject: [PATCH] QWindows11Style: Decrease bottomline frame thickness for QToolButton Decrease the bottom line frame thickness for QToolButton by using fractional coordinates. Task-number: QTBUG-132261 Change-Id: I77a3acdd20c694dce38d809db9c3051949a98fa3 Reviewed-by: Christian Ehrlicher (cherry picked from commit 3e9baca7d2197bfc10d20de6f326e2749a8f781e) Reviewed-by: Qt Cherry-pick Bot (cherry picked from commit f8adee805b9cb673ed66ffa22f5bb1896439e6b3) --- src/plugins/styles/modernwindows/qwindows11style.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/plugins/styles/modernwindows/qwindows11style.cpp b/src/plugins/styles/modernwindows/qwindows11style.cpp index 71160548f08..3cfff1125f4 100644 --- a/src/plugins/styles/modernwindows/qwindows11style.cpp +++ b/src/plugins/styles/modernwindows/qwindows11style.cpp @@ -892,7 +892,7 @@ void QWindows11Style::drawPrimitive(PrimitiveElement element, const QStyleOption else painter->setPen(QPen(WINUI3Colors[colorSchemeIndex][controlStrokePrimary])); painter->setBrush(buttonFillBrush(option)); - painter->drawRoundedRect(rect.marginsAdded(QMargins(0.5, 0.5, 0.5, 0.5)), + painter->drawRoundedRect(rect, secondLevelRoundingRadius, secondLevelRoundingRadius); painter->setPen(Qt::NoPen); @@ -904,8 +904,9 @@ void QWindows11Style::drawPrimitive(PrimitiveElement element, const QStyleOption painter->setBrush(option->palette.button()); painter->drawRoundedRect(rect, secondLevelRoundingRadius, secondLevelRoundingRadius); if (isRaised) { + const qreal sublineOffset = secondLevelRoundingRadius - 0.5; painter->setPen(QPen(WINUI3Colors[colorSchemeIndex][controlStrokeSecondary])); - painter->drawLine(rect.bottomLeft() + QPoint(2,1), rect.bottomRight() + QPoint(-2,1)); + painter->drawLine(rect.bottomLeft() + QPointF(sublineOffset, 0.5), rect.bottomRight() + QPointF(-sublineOffset, 0.5)); } } break;