From ac74885507437a184c8a50d93d3158f09a860f82 Mon Sep 17 00:00:00 2001 From: Wladimir Leuschner Date: Wed, 7 Aug 2024 15:41:44 +0200 Subject: [PATCH] QWindows11Style: Use float coordinates for ticks in QSlider Fixes: QTBUG-127788 Pick-to: 6.7 Change-Id: If7620aade30c45c409cb442a7ed6e4a8aea7551e Reviewed-by: Oliver Wolff (cherry picked from commit 47ba48e0245e6f57ae0c76db626eb63ce6924cfd) Reviewed-by: Qt Cherry-pick Bot --- .../styles/modernwindows/qwindows11style.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/plugins/styles/modernwindows/qwindows11style.cpp b/src/plugins/styles/modernwindows/qwindows11style.cpp index 0da7f4d836b..b2402473b47 100644 --- a/src/plugins/styles/modernwindows/qwindows11style.cpp +++ b/src/plugins/styles/modernwindows/qwindows11style.cpp @@ -366,7 +366,7 @@ void QWindows11Style::drawComplexControl(ComplexControl control, const QStyleOpt int pos; int bothOffset = (ticks & QSlider::TicksAbove && ticks & QSlider::TicksBelow) ? 1 : 0; painter->setPen(slider->palette.text().color()); - QVarLengthArray lines; + QVarLengthArray lines; int v = slider->minimum; while (v <= slider->maximum + 1) { if (v == slider->maximum + 1 && interval == 1) @@ -377,23 +377,23 @@ void QWindows11Style::drawComplexControl(ComplexControl control, const QStyleOpt v_, available) + fudge; if (slider->orientation == Qt::Horizontal) { if (ticks & QSlider::TicksAbove) { - lines.append(QLine(pos, tickOffset - 1 - bothOffset, - pos, tickOffset - 1 - bothOffset - tickLength)); + lines.append(QLineF(pos, tickOffset - 1 - bothOffset + 0.5, + pos, tickOffset - 1 - bothOffset - tickLength - 0.5)); } if (ticks & QSlider::TicksBelow) { - lines.append(QLine(pos, tickOffset + thickness + bothOffset, - pos, tickOffset + thickness + bothOffset + tickLength)); + lines.append(QLineF(pos, tickOffset + thickness + bothOffset - 0.5, + pos, tickOffset + thickness + bothOffset + tickLength + 0.5)); } } else { if (ticks & QSlider::TicksAbove) { - lines.append(QLine(tickOffset - 1 - bothOffset, pos, - tickOffset - 1 - bothOffset - tickLength, pos)); + lines.append(QLineF(tickOffset - 1 - bothOffset + 0.5, pos, + tickOffset - 1 - bothOffset - tickLength - 0.5, pos)); } if (ticks & QSlider::TicksBelow) { - lines.append(QLine(tickOffset + thickness + bothOffset, pos, - tickOffset + thickness + bothOffset + tickLength, pos)); + lines.append(QLineF(tickOffset + thickness + bothOffset - 0.5, pos, + tickOffset + thickness + bothOffset + tickLength + 0.5, pos)); } } // in the case where maximum is max int