diff --git a/companion/src/modeledit/customfunctions.cpp b/companion/src/modeledit/customfunctions.cpp index eee57fd97..c6d09bab3 100644 --- a/companion/src/modeledit/customfunctions.cpp +++ b/companion/src/modeledit/customfunctions.cpp @@ -196,6 +196,8 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData & model, // Push rows upward addDoubleSpring(gridLayout, 5, num_fsw+1); + disableMouseScrolling(); + lock = false; } diff --git a/companion/src/modeledit/modelpanel.cpp b/companion/src/modeledit/modelpanel.cpp index 7ce39f2e8..d25276add 100644 --- a/companion/src/modeledit/modelpanel.cpp +++ b/companion/src/modeledit/modelpanel.cpp @@ -1,5 +1,7 @@ #include "modelpanel.h" #include +#include +#include ModelPanel::ModelPanel(QWidget * parent, ModelData & model, GeneralSettings & generalSettings, FirmwareInterface * firmware): QWidget(parent), @@ -57,3 +59,30 @@ void ModelPanel::addDoubleSpring(QGridLayout * gridLayout, int col, int row) gridLayout->addItem(spacer, row, col); } +bool ModelPanel::eventFilter(QObject *object, QEvent * event) +{ + if (event->type() == QEvent::Wheel && qobject_cast(object)) { + if (qobject_cast(object)->focusPolicy() == Qt::WheelFocus) { + event->accept(); + return false; + } + else { + event->ignore(); + return true; + } + } + return QWidget::eventFilter(object, event); +} + +void ModelPanel::disableMouseScrolling() +{ + Q_FOREACH(QComboBox * cb, findChildren()) { + cb->installEventFilter(this); + cb->setFocusPolicy(Qt::StrongFocus); + } + + Q_FOREACH(QAbstractSpinBox * sb, findChildren()) { + sb->installEventFilter(this); + sb->setFocusPolicy(Qt::StrongFocus); + } +} diff --git a/companion/src/modeledit/modelpanel.h b/companion/src/modeledit/modelpanel.h index 7ff5a3526..fa2a450d6 100644 --- a/companion/src/modeledit/modelpanel.h +++ b/companion/src/modeledit/modelpanel.h @@ -31,6 +31,8 @@ class ModelPanel : public QWidget void addHSpring(QGridLayout *, int col, int row); void addVSpring(QGridLayout *, int col, int row); void addDoubleSpring(QGridLayout *, int col, int row); + virtual bool eventFilter(QObject *obj, QEvent *event); + void disableMouseScrolling(); }; #endif // CHANNELS_H