Issue #1151 - I just added a workaround on the CustomFunctions tab only.
If feedback is good, it will be easy to call disableMouseScrolling() on other tabs.
This commit is contained in:
@@ -196,6 +196,8 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData & model,
|
|||||||
// Push rows upward
|
// Push rows upward
|
||||||
addDoubleSpring(gridLayout, 5, num_fsw+1);
|
addDoubleSpring(gridLayout, 5, num_fsw+1);
|
||||||
|
|
||||||
|
disableMouseScrolling();
|
||||||
|
|
||||||
lock = false;
|
lock = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
#include "modelpanel.h"
|
#include "modelpanel.h"
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
#include <QComboBox>
|
||||||
|
#include <QSpinBox>
|
||||||
|
|
||||||
ModelPanel::ModelPanel(QWidget * parent, ModelData & model, GeneralSettings & generalSettings, FirmwareInterface * firmware):
|
ModelPanel::ModelPanel(QWidget * parent, ModelData & model, GeneralSettings & generalSettings, FirmwareInterface * firmware):
|
||||||
QWidget(parent),
|
QWidget(parent),
|
||||||
@@ -57,3 +59,30 @@ void ModelPanel::addDoubleSpring(QGridLayout * gridLayout, int col, int row)
|
|||||||
gridLayout->addItem(spacer, row, col);
|
gridLayout->addItem(spacer, row, col);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ModelPanel::eventFilter(QObject *object, QEvent * event)
|
||||||
|
{
|
||||||
|
if (event->type() == QEvent::Wheel && qobject_cast<QWidget*>(object)) {
|
||||||
|
if (qobject_cast<QWidget*>(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<QComboBox*>()) {
|
||||||
|
cb->installEventFilter(this);
|
||||||
|
cb->setFocusPolicy(Qt::StrongFocus);
|
||||||
|
}
|
||||||
|
|
||||||
|
Q_FOREACH(QAbstractSpinBox * sb, findChildren<QAbstractSpinBox*>()) {
|
||||||
|
sb->installEventFilter(this);
|
||||||
|
sb->setFocusPolicy(Qt::StrongFocus);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -31,6 +31,8 @@ class ModelPanel : public QWidget
|
|||||||
void addHSpring(QGridLayout *, int col, int row);
|
void addHSpring(QGridLayout *, int col, int row);
|
||||||
void addVSpring(QGridLayout *, int col, int row);
|
void addVSpring(QGridLayout *, int col, int row);
|
||||||
void addDoubleSpring(QGridLayout *, int col, int row);
|
void addDoubleSpring(QGridLayout *, int col, int row);
|
||||||
|
virtual bool eventFilter(QObject *obj, QEvent *event);
|
||||||
|
void disableMouseScrolling();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CHANNELS_H
|
#endif // CHANNELS_H
|
||||||
|
|||||||
Reference in New Issue
Block a user