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:
parent
9c06169a08
commit
ac74885507
@ -366,7 +366,7 @@ void QWindows11Style::drawComplexControl(ComplexControl control, const QStyleOpt
|
|||||||
int pos;
|
int pos;
|
||||||
int bothOffset = (ticks & QSlider::TicksAbove && ticks & QSlider::TicksBelow) ? 1 : 0;
|
int bothOffset = (ticks & QSlider::TicksAbove && ticks & QSlider::TicksBelow) ? 1 : 0;
|
||||||
painter->setPen(slider->palette.text().color());
|
painter->setPen(slider->palette.text().color());
|
||||||
QVarLengthArray<QLine, 32> lines;
|
QVarLengthArray<QLineF, 32> lines;
|
||||||
int v = slider->minimum;
|
int v = slider->minimum;
|
||||||
while (v <= slider->maximum + 1) {
|
while (v <= slider->maximum + 1) {
|
||||||
if (v == slider->maximum + 1 && interval == 1)
|
if (v == slider->maximum + 1 && interval == 1)
|
||||||
@ -377,23 +377,23 @@ void QWindows11Style::drawComplexControl(ComplexControl control, const QStyleOpt
|
|||||||
v_, available) + fudge;
|
v_, available) + fudge;
|
||||||
if (slider->orientation == Qt::Horizontal) {
|
if (slider->orientation == Qt::Horizontal) {
|
||||||
if (ticks & QSlider::TicksAbove) {
|
if (ticks & QSlider::TicksAbove) {
|
||||||
lines.append(QLine(pos, tickOffset - 1 - bothOffset,
|
lines.append(QLineF(pos, tickOffset - 1 - bothOffset + 0.5,
|
||||||
pos, tickOffset - 1 - bothOffset - tickLength));
|
pos, tickOffset - 1 - bothOffset - tickLength - 0.5));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ticks & QSlider::TicksBelow) {
|
if (ticks & QSlider::TicksBelow) {
|
||||||
lines.append(QLine(pos, tickOffset + thickness + bothOffset,
|
lines.append(QLineF(pos, tickOffset + thickness + bothOffset - 0.5,
|
||||||
pos, tickOffset + thickness + bothOffset + tickLength));
|
pos, tickOffset + thickness + bothOffset + tickLength + 0.5));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (ticks & QSlider::TicksAbove) {
|
if (ticks & QSlider::TicksAbove) {
|
||||||
lines.append(QLine(tickOffset - 1 - bothOffset, pos,
|
lines.append(QLineF(tickOffset - 1 - bothOffset + 0.5, pos,
|
||||||
tickOffset - 1 - bothOffset - tickLength, pos));
|
tickOffset - 1 - bothOffset - tickLength - 0.5, pos));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ticks & QSlider::TicksBelow) {
|
if (ticks & QSlider::TicksBelow) {
|
||||||
lines.append(QLine(tickOffset + thickness + bothOffset, pos,
|
lines.append(QLineF(tickOffset + thickness + bothOffset - 0.5, pos,
|
||||||
tickOffset + thickness + bothOffset + tickLength, pos));
|
tickOffset + thickness + bothOffset + tickLength + 0.5, pos));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// in the case where maximum is max int
|
// in the case where maximum is max int
|
||||||
|
Loading…
x
Reference in New Issue
Block a user