fix mouse over in list

This commit is contained in:
Geoffray Levasseur committed 2026-11-09 11:52:17 +01:00
1 parent f7f4e4670b
commit d37a20ce30
1 file changed
+9 -17
+9 -17
View File
@@ -1250,7 +1250,7 @@ void ListDlg::offscreenPaint()
for (int i = -1; i <= dispLines; ++i)
if (i + scrollBar->position() >= 0 && i + scrollBar->position() < static_cast<int>(layer->lines().size()))
paintLine(canvas, i, true, false, false);
paintLine(canvas, i, true, i == selected, false);
canvas.end();
markUsedOffscreen(innerWidth, 8 + 48 + dispLines * lineDistance);
@@ -1593,16 +1593,10 @@ void ListDlg::mouseMoveEvent(QMouseEvent *event)
selected + i0 >= static_cast<int>(layer->lines().size()))
selected = -2;
if (selected != sel0) {
QPainter painter(this);
if (!painter.isActive())
return;
Dpi::Canvas canvas;
canvas.bind(&painter);
if (sel0 != -2)
paintLine(canvas, sel0, false, false, true);
if (selected != -2)
paintLine(canvas, selected, false, true, true);
canvas.unbind();
// Qt doesn't allow painting a widget directly outside paintEvent()
// (unlike the original's live Form.Canvas updates) - offscreenPaint()
// now paints the hovered line "lit", so just trigger a real repaint.
update();
}
if (kind == ListKind::Science) {
@@ -1615,11 +1609,8 @@ void ListDlg::mouseMoveEvent(QMouseEvent *event)
scienceNation = column[static_cast<std::size_t>(iColumn)];
}
if (scienceNation != oldScienceNation) {
QPainter painter(this);
if (!painter.isActive())
return;
Dpi::Canvas canvas;
canvas.bind(&painter);
Dpi::Canvas &canvas = offscreen.canvas();
canvas.begin();
fill(canvas, 9, height() - 29, width() - 18, 24, (MainTexture->width() - width()) / 2,
(MainTexture->height() - height()) / 2);
if (scienceNation >= 0) {
@@ -1639,7 +1630,8 @@ void ListDlg::mouseMoveEvent(QMouseEvent *event)
canvas.fillRect(QRect(xScreen - 10, height() - 27, 17, 17));
canvas.brush().setStyle(Qt::NoBrush);
}
canvas.unbind();
canvas.end();
update(9, height() - 29, width() - 18, 24);
}
}
}