Skip to content

Commit

Permalink
Fix scrolling over UIntSpinBox
Browse files Browse the repository at this point in the history
  • Loading branch information
GriffinRichards committed Nov 20, 2024
1 parent 0a87f7b commit d3a34cf
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/ui/uintspinbox.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "uintspinbox.h"
#include <QWheelEvent>

UIntSpinBox::UIntSpinBox(QWidget *parent)
: QAbstractSpinBox(parent)
Expand Down Expand Up @@ -178,8 +179,11 @@ QAbstractSpinBox::StepEnabled UIntSpinBox::stepEnabled() const {

void UIntSpinBox::wheelEvent(QWheelEvent *event) {
// Only allow scrolling to modify contents when it explicitly has focus.
if (hasFocus())
if (hasFocus()) {
QAbstractSpinBox::wheelEvent(event);
} else {
event->ignore();
}
}

void UIntSpinBox::focusOutEvent(QFocusEvent *event) {
Expand Down

0 comments on commit d3a34cf

Please sign in to comment.