From d82143ba52bd093e8e3694316bb651d17c2ac30b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Br=C3=BCbach?= Date: Mon, 2 Nov 2026 13:57:26 +0100 Subject: [PATCH] [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. --- .../visual_database_display/card_database_visual_view.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cockatrice/src/interface/widgets/visual_database_display/card_database_visual_view.cpp b/cockatrice/src/interface/widgets/visual_database_display/card_database_visual_view.cpp index 7b0d526f9..d8e1ce94f 100644 --- a/cockatrice/src/interface/widgets/visual_database_display/card_database_visual_view.cpp +++ b/cockatrice/src/interface/widgets/visual_database_display/card_database_visual_view.cpp @@ -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; }