[VisualDatabase] Keep the card grid scrolling on macOS

The view ignored the wheel whenever the vertical scroll bar was not
visible. On macOS, scroll bars are transient: once the fade-out finishes,
QScrollbarStyleAnimation hides the scroll bar widget, so isVisible() then
reports false even though the grid has more rows to scroll. Scrolling was
dead until something else brought the bar back.

Gate on the scroll bar's range instead: it says whether there is anything
to scroll, while visibility is only about presentation. An event with no
range to scroll is still ignored, so an enclosing scroll area can take it.
This commit is contained in:
Lukas Brübach 2026-11-02 13:57:26 +01:00
parent 9f30892dff
commit d82143ba52

View file

@ -130,8 +130,13 @@ void CardDatabaseVisualView::wheelEvent(QWheelEvent *event)
return;
}
// Whether the scroll bar is shown says nothing about whether the grid can
// scroll: macOS uses transient (overlay) scroll bars that hide themselves
// once they fade out, and Qt hides the widget for good when that happens.
// The range is the real answer; ignoring the wheel when there is nothing to
// scroll still lets an enclosing scroll area take over.
QScrollBar *bar = verticalScrollBar();
if (!bar->isVisible()) {
if (bar->maximum() <= bar->minimum()) {
event->ignore();
return;
}