From a53e095882551caf3684a1f6a205b6c7d76a8913 Mon Sep 17 00:00:00 2001 From: Wladimir Leuschner Date: Tue, 17 Dec 2024 15:33:05 +0100 Subject: [PATCH] QWindows11Style: Align QSpinBox rect to match QLineEdits rect The content rects for QSpinBoxes were smaller than QLineEdits rects for UI elements that should have the same size. This patch increases the content rect for QSpinBoxes. Task-number: QTBUG-132261 Pick-to: 6.9 6.8 Change-Id: I59e752b719399c5845ab3ef81c6e271deda16273 Reviewed-by: Christian Ehrlicher --- src/plugins/styles/modernwindows/qwindows11style.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/plugins/styles/modernwindows/qwindows11style.cpp b/src/plugins/styles/modernwindows/qwindows11style.cpp index 9f3134cef51..393ef765edd 100644 --- a/src/plugins/styles/modernwindows/qwindows11style.cpp +++ b/src/plugins/styles/modernwindows/qwindows11style.cpp @@ -253,14 +253,15 @@ void QWindows11Style::drawComplexControl(ComplexControl control, const QStyleOpt sb, sb->rect.size()); if (cp.needsPainting()) { if (sb->frame && (sub & SC_SpinBoxFrame)) { + const qreal sublineOffset = secondLevelRoundingRadius + 2.0; cp->save(); cp->setClipRect(option->rect.adjusted(-2, -2, 2, 2)); cp->setPen(editSublineColor(option, colorSchemeIndex)); - cp->drawLine(option->rect.bottomLeft() + QPointF(7, -0.5), - option->rect.bottomRight() + QPointF(-7, -0.5)); + cp->drawLine(option->rect.bottomLeft() + QPointF(sublineOffset, 0.5), + option->rect.bottomRight() + QPointF(-sublineOffset, 0.5)); cp->restore(); } - const QRectF frameRect = QRectF(option->rect).adjusted(2.5, 2.5, -2.5, -2.5); + const QRectF frameRect = QRectF(option->rect).marginsRemoved(QMarginsF(1.5, 1.5, 1.5, 1.5)); const QBrush fillBrush = option->palette.brush(QPalette::Base); cp->setBrush(fillBrush); cp->setPen(QPen(highContrastTheme == true ? sb->palette.buttonText().color()