Fix NoScrollComboBox and NoScrollSpinBox stopping parent's scrolling

This commit is contained in:
GriffinR 2024-10-10 16:11:01 -04:00
parent e38e05e95a
commit caeaeac1f6
3 changed files with 11 additions and 2 deletions

View file

@ -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

View file

@ -2,6 +2,7 @@
#include <QCompleter>
#include <QLineEdit>
#include <QWheelEvent>
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)

View file

@ -1,4 +1,5 @@
#include "noscrollspinbox.h"
#include <QWheelEvent>
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) {