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:
bsongis
2014-06-06 23:25:32 +02:00
parent c1e15d0212
commit 626f4c5784
3 changed files with 33 additions and 0 deletions
@@ -196,6 +196,8 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData & model,
// Push rows upward
addDoubleSpring(gridLayout, 5, num_fsw+1);
disableMouseScrolling();
lock = false;
}
+29
View File
@@ -1,5 +1,7 @@
#include "modelpanel.h"
#include <QLabel>
#include <QComboBox>
#include <QSpinBox>
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<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);
}
}
+2
View File
@@ -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