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 <ch.ehrlicher@gmx.de>
(cherry picked from commit 3d45d22b536cd5fa074f6de4d02b1fd049e6b220)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Wladimir Leuschner 2025-02-05 11:11:36 +01:00 committed by Qt Cherry-pick Bot
parent 5296136496
commit 9f7437fb85

View File

@ -801,10 +801,11 @@ void QWindows11Style::drawPrimitive(PrimitiveElement element, const QStyleOption
break; break;
case PE_IndicatorCheckBox: case PE_IndicatorCheckBox:
{ {
const bool isRtl = option->direction == Qt::RightToLeft;
QNumberStyleAnimation* animation = qobject_cast<QNumberStyleAnimation*>(d->animation(option->styleObject)); QNumberStyleAnimation* animation = qobject_cast<QNumberStyleAnimation*>(d->animation(option->styleObject));
QFontMetrics fm(assetFont); 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); QPointF center = QPointF(rect.x() + rect.width() / 2, rect.y() + rect.height() / 2);
rect.setWidth(15); rect.setWidth(15);
rect.setHeight(15); rect.setHeight(15);
@ -851,6 +852,7 @@ void QWindows11Style::drawPrimitive(PrimitiveElement element, const QStyleOption
break; break;
case PE_IndicatorRadioButton: case PE_IndicatorRadioButton:
{ {
const bool isRtl = option->direction == Qt::RightToLeft;
qreal innerRadius = option->state & State_On ? 4.0f :7.0f; qreal innerRadius = option->state & State_On ? 4.0f :7.0f;
if (option->styleObject) { if (option->styleObject) {
if (option->styleObject->property("_q_end_radius").isNull()) if (option->styleObject->property("_q_end_radius").isNull())
@ -861,7 +863,7 @@ void QWindows11Style::drawPrimitive(PrimitiveElement element, const QStyleOption
} }
QPainterPath path; 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); QPointF center = QPoint(rect.x() + rect.width() / 2, rect.y() + rect.height() / 2);
rect.setWidth(15); rect.setWidth(15);
rect.setHeight(15); rect.setHeight(15);