From 9f7437fb858cc69fcd50b32809e9bd83355d0947 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 Pick-to: 6.8 Change-Id: I2e0186cbdad12481922de5ddf00f50daeb94bb37 Reviewed-by: Christian Ehrlicher (cherry picked from commit 3d45d22b536cd5fa074f6de4d02b1fd049e6b220) Reviewed-by: Qt Cherry-pick Bot --- 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 956fdc47891..fbcbff2b483 100644 --- a/src/plugins/styles/modernwindows/qwindows11style.cpp +++ b/src/plugins/styles/modernwindows/qwindows11style.cpp @@ -801,10 +801,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); @@ -851,6 +852,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()) @@ -861,7 +863,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);