Fix NoScrollComboBox and NoScrollSpinBox stopping parent's scrolling
This commit is contained in:
parent
e38e05e95a
commit
caeaeac1f6
3 changed files with 11 additions and 2 deletions
|
@ -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 stitched map images sometimes rendering garbage
|
||||||
- Fix the `Reset` button on `Export Map Timelapse Image` not resetting the Timelapse settings.
|
- 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.
|
- 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
|
## [5.4.1] - 2024-03-21
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include <QCompleter>
|
#include <QCompleter>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
|
#include <QWheelEvent>
|
||||||
|
|
||||||
NoScrollComboBox::NoScrollComboBox(QWidget *parent)
|
NoScrollComboBox::NoScrollComboBox(QWidget *parent)
|
||||||
: QComboBox(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.
|
// 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 focusedScrollingEnabled is false it won't allow scrolling even with focus.
|
||||||
if (this->focusedScrollingEnabled && hasFocus())
|
if (this->focusedScrollingEnabled && hasFocus()) {
|
||||||
QComboBox::wheelEvent(event);
|
QComboBox::wheelEvent(event);
|
||||||
|
} else {
|
||||||
|
event->ignore();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void NoScrollComboBox::setFocusedScrollingEnabled(bool enabled)
|
void NoScrollComboBox::setFocusedScrollingEnabled(bool enabled)
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include "noscrollspinbox.h"
|
#include "noscrollspinbox.h"
|
||||||
|
#include <QWheelEvent>
|
||||||
|
|
||||||
unsigned actionId = 0xffff;
|
unsigned actionId = 0xffff;
|
||||||
|
|
||||||
|
@ -12,8 +13,11 @@ NoScrollSpinBox::NoScrollSpinBox(QWidget *parent)
|
||||||
void NoScrollSpinBox::wheelEvent(QWheelEvent *event)
|
void NoScrollSpinBox::wheelEvent(QWheelEvent *event)
|
||||||
{
|
{
|
||||||
// Only allow scrolling to modify contents when it explicitly has focus.
|
// Only allow scrolling to modify contents when it explicitly has focus.
|
||||||
if (hasFocus())
|
if (hasFocus()) {
|
||||||
QSpinBox::wheelEvent(event);
|
QSpinBox::wheelEvent(event);
|
||||||
|
} else {
|
||||||
|
event->ignore();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void NoScrollSpinBox::focusOutEvent(QFocusEvent *event) {
|
void NoScrollSpinBox::focusOutEvent(QFocusEvent *event) {
|
||||||
|
|
Loading…
Reference in a new issue