QWindows11Style: Use float coordinates for ticks in QSlider

Fixes: QTBUG-127788
Pick-to: 6.7
Change-Id: If7620aade30c45c409cb442a7ed6e4a8aea7551e
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
(cherry picked from commit 47ba48e0245e6f57ae0c76db626eb63ce6924cfd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Wladimir Leuschner 2024-08-07 15:41:44 +02:00 committed by Qt Cherry-pick Bot
parent 9c06169a08
commit ac74885507

View File

@ -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<QLine, 32> lines;
QVarLengthArray<QLineF, 32> 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