From d37a20ce3098a7f34bbadf78744935da7a87c6c6 Mon Sep 17 00:00:00 2001 From: Geoffray Levasseur Date: Mon, 9 Nov 2026 11:52:17 +0100 Subject: [PATCH] fix mouse over in list --- game/localplayer/Select.cpp | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/game/localplayer/Select.cpp b/game/localplayer/Select.cpp index c15b21c..83d5fe9 100644 --- a/game/localplayer/Select.cpp +++ b/game/localplayer/Select.cpp @@ -1250,7 +1250,7 @@ void ListDlg::offscreenPaint() for (int i = -1; i <= dispLines; ++i) if (i + scrollBar->position() >= 0 && i + scrollBar->position() < static_cast(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(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(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); } } }