From 4b763eab2390cb04c64838ca86c193d0282e5b1e Mon Sep 17 00:00:00 2001 From: Wladimir Leuschner Date: Tue, 17 Dec 2024 15:01:35 +0100 Subject: [PATCH] QWindows11Style: Increase QComboBoxSize and align subline Increase the size of QComboBoxSize and align the subline for editable QComboBoxes with the begin end end of the rounded corners. Task-number: QTBUG-132261 Change-Id: I235ec1ceb94a5e87f373b007ac31d0d8a83cf600 Reviewed-by: Christian Ehrlicher (cherry picked from commit 23c16c611cfeee55ce38e928989b346c697270b0) Reviewed-by: Qt Cherry-pick Bot (cherry picked from commit 840cf0a43a3242c7e5fd6769efe37c5d6e3b400e) --- src/plugins/styles/modernwindows/qwindows11style.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/plugins/styles/modernwindows/qwindows11style.cpp b/src/plugins/styles/modernwindows/qwindows11style.cpp index c653cb6db3b..71160548f08 100644 --- a/src/plugins/styles/modernwindows/qwindows11style.cpp +++ b/src/plugins/styles/modernwindows/qwindows11style.cpp @@ -435,7 +435,7 @@ void QWindows11Style::drawComplexControl(ComplexControl control, const QStyleOpt case CC_ComboBox: if (const QStyleOptionComboBox *combobox = qstyleoption_cast(option)) { QBrush fillColor = combobox->palette.brush(QPalette::Base); - QRectF rect = option->rect.adjusted(2,2,-2,-2); + QRectF rect = option->rect.marginsRemoved(QMargins(1, 1, 1, 1)); painter->setBrush(fillColor); painter->setPen(Qt::NoPen); painter->drawRoundedRect(rect, secondLevelRoundingRadius, secondLevelRoundingRadius); @@ -460,10 +460,9 @@ void QWindows11Style::drawComplexControl(ComplexControl control, const QStyleOpt painter->drawText(rect, QStringLiteral(u"\uE70D"), Qt::AlignVCenter | Qt::AlignHCenter); } if (combobox->editable) { + const qreal sublineOffset = secondLevelRoundingRadius; painter->setPen(editSublineColor(option, colorSchemeIndex)); - painter->drawLine(rect.bottomLeft() + QPoint(2,1), rect.bottomRight() + QPoint(-2,1)); - if (state & State_HasFocus) - painter->drawLine(rect.bottomLeft() + QPoint(3,2), rect.bottomRight() + QPoint(-3,2)); + painter->drawLine(rect.bottomLeft() + QPointF(sublineOffset, 1.0), rect.bottomRight() + QPointF(-sublineOffset, 1.0)); } } break; @@ -951,6 +950,8 @@ void QWindows11Style::drawPrimitive(PrimitiveElement element, const QStyleOption break; case PE_FrameLineEdit: { const qreal sublineOffset = secondLevelRoundingRadius + 1.5; + if (widget && widget->parent() && qobject_cast(widget->parent())) + break; QRectF rect = option->rect; rect.adjust(1.5, 1.5, -1.5, -1.5); painter->setBrush(Qt::NoBrush);