mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-13 05:20:00 -08:00
[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:
parent
9f30892dff
commit
d82143ba52
1 changed files with 6 additions and 1 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue