From caeaeac1f67014e43787b8af112f4ee736d7cec4 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Thu, 10 Oct 2024 16:11:01 -0400 Subject: [PATCH] Fix NoScrollComboBox and NoScrollSpinBox stopping parent's scrolling --- CHANGELOG.md | 1 + src/ui/noscrollcombobox.cpp | 6 +++++- src/ui/noscrollspinbox.cpp | 6 +++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 359b77e2..c2c55fdf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -50,6 +50,7 @@ The **"Breaking Changes"** listed below are changes that have been made in the d - Fix stitched map images sometimes rendering garbage - Fix the `Reset` button on `Export Map Timelapse Image` not resetting the Timelapse settings. - Stop sliders in the Palette Editor from creating a bunch of edit history when used. +- Fix scrolling on some containers locking up when the mouse stops over a spin box or combo box. ## [5.4.1] - 2024-03-21 ### Fixed diff --git a/src/ui/noscrollcombobox.cpp b/src/ui/noscrollcombobox.cpp index 542bf5fd..e6e21a4e 100644 --- a/src/ui/noscrollcombobox.cpp +++ b/src/ui/noscrollcombobox.cpp @@ -2,6 +2,7 @@ #include #include +#include NoScrollComboBox::NoScrollComboBox(QWidget *parent) : QComboBox(parent) @@ -39,8 +40,11 @@ void NoScrollComboBox::wheelEvent(QWheelEvent *event) { // By default NoScrollComboBoxes will allow scrolling to modify its contents only when it explicitly has focus. // If focusedScrollingEnabled is false it won't allow scrolling even with focus. - if (this->focusedScrollingEnabled && hasFocus()) + if (this->focusedScrollingEnabled && hasFocus()) { QComboBox::wheelEvent(event); + } else { + event->ignore(); + } } void NoScrollComboBox::setFocusedScrollingEnabled(bool enabled) diff --git a/src/ui/noscrollspinbox.cpp b/src/ui/noscrollspinbox.cpp index 144b0e91..f8d1d444 100644 --- a/src/ui/noscrollspinbox.cpp +++ b/src/ui/noscrollspinbox.cpp @@ -1,4 +1,5 @@ #include "noscrollspinbox.h" +#include unsigned actionId = 0xffff; @@ -12,8 +13,11 @@ NoScrollSpinBox::NoScrollSpinBox(QWidget *parent) void NoScrollSpinBox::wheelEvent(QWheelEvent *event) { // Only allow scrolling to modify contents when it explicitly has focus. - if (hasFocus()) + if (hasFocus()) { QSpinBox::wheelEvent(event); + } else { + event->ignore(); + } } void NoScrollSpinBox::focusOutEvent(QFocusEvent *event) {