Rubber Band Selection Highlight Not Clearing Properly #20

Closed
opened 2026-06-07 16:31:32 +00:00 by ValleyGeek · 2 comments
Owner

In the grid after images are highlighted with the rubber band and the user clicks away in the scene, the first image in the group remains highlighted. Clicking another image highlights the new image but leaves a different colored highlight in tact on the rubber banded image. Beginning a new rubber band resets the highlight.

In the `grid` after images are highlighted with the rubber band and the user clicks away in the scene, the first image in the group remains highlighted. Clicking another image highlights the new image but leaves a different colored highlight in tact on the rubber banded image. Beginning a new rubber band resets the highlight.
Author
Owner

When scrolling through the grid using the mouse wheel, whichever image the cursor is on top of after the scroll gets the same highlight that's not able to be cleared. Maybe it's hover classed element.

When scrolling through the grid using the mouse wheel, whichever image the cursor is on top of after the scroll gets the same highlight that's not able to be cleared. Maybe it's hover classed element.
ValleyGeek changed title from Bug: Rubber Band Selection Highlight Not Clearing Properly to Rubber Band Selection Highlight Not Clearing Properly 2026-06-09 02:34:16 +00:00
Member

Fixed on branch 0.1.39/issue-20-rubber-band-highlight (queued for PR to main, not yet opened).

Root cause: Qt suppresses hover events for a widget while a mouse button is held down. So whatever thumbnail was hovered right before a rubber-band drag began stays painted with the gray "moused over" highlight for the whole drag. GridSelectionFilter then fully consumes the next plain click or empty-space click (it returns True from its event filter), which skips Qt's own native click handling — the handling that would otherwise have refreshed hover — so that stale gray highlight kept sitting on the original image even after a different image was correctly (blue) selected. Starting a new rubber-band drag "fixed" it only because dragging across cells generates fresh mouse-move events once you release the button, which is why that workaround was visible in the report.

Fix: GridSelectionFilter now sends itself a synthetic hover-move event at the current cursor position immediately after handling any left-button release, forcing Qt to recompute the hover highlight right away instead of waiting for some later real mouse movement.

Added a regression test (tests/test_grid_selection_filter.py::test_grid_selection_click_after_drag_refreshes_hover) asserting a hover refresh is triggered on click-release.

Closing — fix implemented and tested. Reopen if the stuck highlight still reproduces once you've had a chance to try a build from this branch.

Fixed on branch `0.1.39/issue-20-rubber-band-highlight` (queued for PR to `main`, not yet opened). Root cause: Qt suppresses hover events for a widget while a mouse button is held down. So whatever thumbnail was hovered right before a rubber-band drag began stays painted with the gray "moused over" highlight for the whole drag. `GridSelectionFilter` then fully consumes the next plain click or empty-space click (it returns `True` from its event filter), which skips Qt's own native click handling — the handling that would otherwise have refreshed hover — so that stale gray highlight kept sitting on the original image even after a different image was correctly (blue) selected. Starting a new rubber-band drag "fixed" it only because dragging across cells generates fresh mouse-move events once you release the button, which is why that workaround was visible in the report. Fix: `GridSelectionFilter` now sends itself a synthetic hover-move event at the current cursor position immediately after handling any left-button release, forcing Qt to recompute the hover highlight right away instead of waiting for some later real mouse movement. Added a regression test (`tests/test_grid_selection_filter.py::test_grid_selection_click_after_drag_refreshes_hover`) asserting a hover refresh is triggered on click-release. Closing — fix implemented and tested. Reopen if the stuck highlight still reproduces once you've had a chance to try a build from this branch.
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ai-collab/bulk-image-organizer#20
No description provided.