From 45cef5b85bb1e183b055481d581883cd865561a0 Mon Sep 17 00:00:00 2001 From: Wladimir Leuschner Date: Wed, 5 Feb 2025 11:11:36 +0100 Subject: [PATCH] QWindows11Style: Add left margins to Radio/Checkbox indicator On 150% DPI scaling, the Radio/Checkbox indicators were clipped. This patch adds an extra margin to the left to avoid this clipping. Fixes: QTBUG-133117 Change-Id: I2e0186cbdad12481922de5ddf00f50daeb94bb37 Reviewed-by: Christian Ehrlicher (cherry picked from commit 3d45d22b536cd5fa074f6de4d02b1fd049e6b220) Reviewed-by: Qt Cherry-pick Bot (cherry picked from commit 9f7437fb858cc69fcd50b32809e9bd83355d0947) --- src/plugins/styles/modernwindows/qwindows11style.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plugins/styles/modernwindows/qwindows11style.cpp b/src/plugins/styles/modernwindows/qwindows11style.cpp index 37a9827f5d..98f05ae1ba 100644 --- a/src/plugins/styles/modernwindows/qwindows11style.cpp +++ b/src/plugins/styles/modernwindows/qwindows11style.cpp @@ -794,10 +794,11 @@ void QWindows11Style::drawPrimitive(PrimitiveElement element, const QStyleOption break; case PE_IndicatorCheckBox: { + const bool isRtl = option->direction == Qt::RightToLeft; QNumberStyleAnimation* animation = qobject_cast(d->animation(option->styleObject)); QFontMetrics fm(assetFont); - QRectF rect = option->rect; + QRectF rect = isRtl ? option->rect.adjusted(0, 0, -2, 0) : option->rect.adjusted(2, 0, 0, 0); QPointF center = QPointF(rect.x() + rect.width() / 2, rect.y() + rect.height() / 2); rect.setWidth(15); rect.setHeight(15); @@ -843,6 +844,7 @@ void QWindows11Style::drawPrimitive(PrimitiveElement element, const QStyleOption break; case PE_IndicatorRadioButton: { + const bool isRtl = option->direction == Qt::RightToLeft; qreal innerRadius = option->state & State_On ? 4.0f :7.0f; if (option->styleObject) { if (option->styleObject->property("_q_end_radius").isNull()) @@ -853,7 +855,7 @@ void QWindows11Style::drawPrimitive(PrimitiveElement element, const QStyleOption } QPainterPath path; - QRectF rect = option->rect; + QRectF rect = isRtl ? option->rect.adjusted(0, 0, -2, 0) : option->rect.adjusted(2, 0, 0, 0); QPointF center = QPoint(rect.x() + rect.width() / 2, rect.y() + rect.height() / 2); rect.setWidth(15); rect.setHeight(15);