Fix scrolling over UIntSpinBox
This commit is contained in:
parent
0a87f7b945
commit
d3a34cf5fc
1 changed files with 5 additions and 1 deletions
|
@ -1,4 +1,5 @@
|
||||||
#include "uintspinbox.h"
|
#include "uintspinbox.h"
|
||||||
|
#include <QWheelEvent>
|
||||||
|
|
||||||
UIntSpinBox::UIntSpinBox(QWidget *parent)
|
UIntSpinBox::UIntSpinBox(QWidget *parent)
|
||||||
: QAbstractSpinBox(parent)
|
: QAbstractSpinBox(parent)
|
||||||
|
@ -178,8 +179,11 @@ QAbstractSpinBox::StepEnabled UIntSpinBox::stepEnabled() const {
|
||||||
|
|
||||||
void UIntSpinBox::wheelEvent(QWheelEvent *event) {
|
void UIntSpinBox::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()) {
|
||||||
QAbstractSpinBox::wheelEvent(event);
|
QAbstractSpinBox::wheelEvent(event);
|
||||||
|
} else {
|
||||||
|
event->ignore();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UIntSpinBox::focusOutEvent(QFocusEvent *event) {
|
void UIntSpinBox::focusOutEvent(QFocusEvent *event) {
|
||||||
|
|
Loading…
Reference in a new issue