mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-01 09:24:10 +01:00
Made the scroll event filter a member of the parent class.
This commit is contained in:
parent
4fedbd7df4
commit
8fc3958f80
@ -90,16 +90,7 @@ ConfigCameraStabilizationWidget::ConfigCameraStabilizationWidget(QWidget *parent
|
||||
connect(m_camerastabilization->camerastabilizationSaveSD, SIGNAL(clicked()), this, SLOT(saveSettings()));
|
||||
connect(m_camerastabilization->camerastabilizationHelp, SIGNAL(clicked()), this, SLOT(openHelp()));
|
||||
|
||||
//Disable mouse wheel events
|
||||
foreach( QSpinBox * sp, findChildren<QSpinBox*>() ) {
|
||||
sp->installEventFilter( this );
|
||||
}
|
||||
foreach( QDoubleSpinBox * sp, findChildren<QDoubleSpinBox*>() ) {
|
||||
sp->installEventFilter( this );
|
||||
}
|
||||
foreach( QSlider * sp, findChildren<QSlider*>() ) {
|
||||
sp->installEventFilter( this );
|
||||
}
|
||||
disbleMouseWheelEvents();
|
||||
}
|
||||
|
||||
ConfigCameraStabilizationWidget::~ConfigCameraStabilizationWidget()
|
||||
@ -107,19 +98,6 @@ ConfigCameraStabilizationWidget::~ConfigCameraStabilizationWidget()
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
|
||||
bool ConfigCameraStabilizationWidget::eventFilter( QObject * obj, QEvent * evt ) {
|
||||
//Filter all wheel events, and ignore them
|
||||
if ( evt->type() == QEvent::Wheel &&
|
||||
(qobject_cast<QAbstractSpinBox*>( obj ) || qobject_cast<QAbstractSlider*>( obj ) ))
|
||||
{
|
||||
evt->ignore();
|
||||
return true;
|
||||
}
|
||||
return QWidget::eventFilter( obj, evt );
|
||||
}
|
||||
|
||||
|
||||
void ConfigCameraStabilizationWidget::connectUpdates()
|
||||
{
|
||||
// Now connect the widget to the StabilizationSettings object
|
||||
|
@ -41,7 +41,6 @@ class ConfigCameraStabilizationWidget: public ConfigTaskWidget
|
||||
public:
|
||||
ConfigCameraStabilizationWidget(QWidget *parent = 0);
|
||||
~ConfigCameraStabilizationWidget();
|
||||
bool eventFilter( QObject * obj, QEvent * evt );
|
||||
private:
|
||||
Ui_CameraStabilizationWidget *m_camerastabilization;
|
||||
virtual void enableControls(bool enable);
|
||||
|
@ -53,17 +53,7 @@ ConfigStabilizationWidget::ConfigStabilizationWidget(QWidget *parent) : ConfigTa
|
||||
|
||||
connect(this,SIGNAL(widgetContentsChanged(QWidget*)),this,SLOT(processLinkedWidgets(QWidget*)));
|
||||
|
||||
//Disable mouse wheel events
|
||||
foreach( QSpinBox * sp, findChildren<QSpinBox*>() ) {
|
||||
sp->installEventFilter( this );
|
||||
}
|
||||
foreach( QDoubleSpinBox * sp, findChildren<QDoubleSpinBox*>() ) {
|
||||
sp->installEventFilter( this );
|
||||
}
|
||||
foreach( QSlider * sp, findChildren<QSlider*>() ) {
|
||||
sp->installEventFilter( this );
|
||||
}
|
||||
|
||||
disbleMouseWheelEvents();
|
||||
}
|
||||
|
||||
|
||||
@ -72,19 +62,6 @@ ConfigStabilizationWidget::~ConfigStabilizationWidget()
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
|
||||
bool ConfigStabilizationWidget::eventFilter( QObject * obj, QEvent * evt ) {
|
||||
//Filter all wheel events, and ignore them
|
||||
if ( evt->type() == QEvent::Wheel &&
|
||||
(qobject_cast<QAbstractSpinBox*>( obj ) || qobject_cast<QAbstractSlider*>( obj ) ))
|
||||
{
|
||||
evt->ignore();
|
||||
return true;
|
||||
}
|
||||
return QWidget::eventFilter( obj, evt );
|
||||
}
|
||||
|
||||
|
||||
void ConfigStabilizationWidget::realtimeUpdatesSlot(int value)
|
||||
{
|
||||
m_stabilization->realTimeUpdates_6->setCheckState((Qt::CheckState)value);
|
||||
|
@ -44,7 +44,6 @@ class ConfigStabilizationWidget: public ConfigTaskWidget
|
||||
public:
|
||||
ConfigStabilizationWidget(QWidget *parent = 0);
|
||||
~ConfigStabilizationWidget();
|
||||
bool eventFilter( QObject * o, QEvent * e );
|
||||
|
||||
private:
|
||||
Ui_StabilizationWidget *m_stabilization;
|
||||
|
@ -68,16 +68,7 @@ ConfigTxPIDWidget::ConfigTxPIDWidget(QWidget *parent) : ConfigTaskWidget(parent)
|
||||
populateWidgets();
|
||||
refreshWidgetsValues();
|
||||
|
||||
//Disable mouse wheel events
|
||||
foreach( QSpinBox * sp, findChildren<QSpinBox*>() ) {
|
||||
sp->installEventFilter( this );
|
||||
}
|
||||
foreach( QDoubleSpinBox * sp, findChildren<QDoubleSpinBox*>() ) {
|
||||
sp->installEventFilter( this );
|
||||
}
|
||||
foreach( QSlider * sp, findChildren<QSlider*>() ) {
|
||||
sp->installEventFilter( this );
|
||||
}
|
||||
disbleMouseWheelEvents();
|
||||
}
|
||||
|
||||
ConfigTxPIDWidget::~ConfigTxPIDWidget()
|
||||
@ -85,19 +76,6 @@ ConfigTxPIDWidget::~ConfigTxPIDWidget()
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
|
||||
bool ConfigTxPIDWidget::eventFilter( QObject * obj, QEvent * evt ) {
|
||||
//Filter all wheel events, and ignore them
|
||||
if ( evt->type() == QEvent::Wheel &&
|
||||
(qobject_cast<QAbstractSpinBox*>( obj ) || qobject_cast<QAbstractSlider*>( obj ) ))
|
||||
{
|
||||
evt->ignore();
|
||||
return true;
|
||||
}
|
||||
return QWidget::eventFilter( obj, evt );
|
||||
}
|
||||
|
||||
|
||||
void ConfigTxPIDWidget::refreshValues()
|
||||
{
|
||||
HwSettings *hwSettings = HwSettings::GetInstance(getObjectManager());
|
||||
|
@ -37,7 +37,6 @@ class ConfigTxPIDWidget : public ConfigTaskWidget
|
||||
public:
|
||||
ConfigTxPIDWidget(QWidget *parent = 0);
|
||||
~ConfigTxPIDWidget();
|
||||
bool eventFilter( QObject * obj, QEvent * evt );
|
||||
private:
|
||||
Ui_TxPIDWidget *m_txpid;
|
||||
|
||||
|
@ -233,16 +233,7 @@ ConfigVehicleTypeWidget::ConfigVehicleTypeWidget(QWidget *parent) : ConfigTaskWi
|
||||
setupGroundVehicleUI( m_aircraft->groundVehicleType->currentText() );
|
||||
setupFixedWingUI( m_aircraft->fixedWingType->currentText() );
|
||||
|
||||
//Disable mouse wheel events
|
||||
foreach( QSpinBox * sp, findChildren<QSpinBox*>() ) {
|
||||
sp->installEventFilter( this );
|
||||
}
|
||||
foreach( QDoubleSpinBox * sp, findChildren<QDoubleSpinBox*>() ) {
|
||||
sp->installEventFilter( this );
|
||||
}
|
||||
foreach( QSlider * sp, findChildren<QSlider*>() ) {
|
||||
sp->installEventFilter( this );
|
||||
}
|
||||
disbleMouseWheelEvents();
|
||||
}
|
||||
|
||||
|
||||
@ -254,19 +245,6 @@ ConfigVehicleTypeWidget::~ConfigVehicleTypeWidget()
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
|
||||
bool ConfigVehicleTypeWidget::eventFilter( QObject * obj, QEvent * evt ) {
|
||||
//Filter all wheel events, and ignore them
|
||||
if ( evt->type() == QEvent::Wheel &&
|
||||
(qobject_cast<QAbstractSpinBox*>( obj ) || qobject_cast<QAbstractSlider*>( obj ) ))
|
||||
{
|
||||
evt->ignore();
|
||||
return true;
|
||||
}
|
||||
return QWidget::eventFilter( obj, evt );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Slot for switching the airframe type. We do it explicitely
|
||||
rather than a signal in the UI, because we want to force a fitInView of the quad shapes.
|
||||
|
@ -46,7 +46,6 @@ class ConfigVehicleTypeWidget: public ConfigTaskWidget
|
||||
public:
|
||||
ConfigVehicleTypeWidget(QWidget *parent = 0);
|
||||
~ConfigVehicleTypeWidget();
|
||||
bool eventFilter( QObject * obj, QEvent * evt );
|
||||
|
||||
private:
|
||||
Ui_AircraftWidget *m_aircraft;
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include "manualcontrolsettings.h"
|
||||
|
||||
inputChannelForm::inputChannelForm(QWidget *parent,bool showlegend) :
|
||||
QWidget(parent),
|
||||
ConfigTaskWidget(parent),
|
||||
ui(new Ui::inputChannelForm)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
@ -37,16 +37,7 @@ inputChannelForm::inputChannelForm(QWidget *parent,bool showlegend) :
|
||||
connect(ui->channelNumberDropdown,SIGNAL(currentIndexChanged(int)),this,SLOT(channelDropdownUpdated(int)));
|
||||
connect(ui->channelNumber,SIGNAL(valueChanged(int)),this,SLOT(channelNumberUpdated(int)));
|
||||
|
||||
//Disable mouse wheel events
|
||||
foreach( QSpinBox * sp, findChildren<QSpinBox*>() ) {
|
||||
sp->installEventFilter( this );
|
||||
}
|
||||
foreach( QDoubleSpinBox * sp, findChildren<QDoubleSpinBox*>() ) {
|
||||
sp->installEventFilter( this );
|
||||
}
|
||||
foreach( QSlider * sp, findChildren<QSlider*>() ) {
|
||||
sp->installEventFilter( this );
|
||||
}
|
||||
disbleMouseWheelEvents();
|
||||
}
|
||||
|
||||
|
||||
@ -55,19 +46,6 @@ inputChannelForm::~inputChannelForm()
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
||||
bool inputChannelForm::eventFilter( QObject * obj, QEvent * evt ) {
|
||||
//Filter all wheel events, and ignore them
|
||||
if ( evt->type() == QEvent::Wheel &&
|
||||
(qobject_cast<QAbstractSpinBox*>( obj ) || qobject_cast<QAbstractSlider*>( obj ) ))
|
||||
{
|
||||
evt->ignore();
|
||||
return true;
|
||||
}
|
||||
return QWidget::eventFilter( obj, evt );
|
||||
}
|
||||
|
||||
|
||||
void inputChannelForm::setName(QString &name)
|
||||
{
|
||||
ui->channelName->setText(name);
|
||||
|
@ -7,14 +7,13 @@ namespace Ui {
|
||||
class inputChannelForm;
|
||||
}
|
||||
|
||||
class inputChannelForm : public QWidget
|
||||
class inputChannelForm : public ConfigTaskWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit inputChannelForm(QWidget *parent = 0,bool showlegend=false);
|
||||
~inputChannelForm();
|
||||
bool eventFilter( QObject * obj, QEvent * evt );
|
||||
friend class ConfigInputWidget;
|
||||
void setName(QString &name);
|
||||
private slots:
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include "configoutputwidget.h"
|
||||
|
||||
OutputChannelForm::OutputChannelForm(const int index, QWidget *parent, const bool showLegend) :
|
||||
QWidget(parent),
|
||||
ConfigTaskWidget(parent),
|
||||
ui(),
|
||||
m_index(index),
|
||||
m_inChannelTest(false)
|
||||
@ -71,16 +71,7 @@ OutputChannelForm::OutputChannelForm(const int index, QWidget *parent, const boo
|
||||
connect(ui.actuatorLink, SIGNAL(toggled(bool)),
|
||||
this, SLOT(linkToggled(bool)));
|
||||
|
||||
//Disable mouse wheel events
|
||||
foreach( QSpinBox * sp, findChildren<QSpinBox*>() ) {
|
||||
sp->installEventFilter( this );
|
||||
}
|
||||
foreach( QDoubleSpinBox * sp, findChildren<QDoubleSpinBox*>() ) {
|
||||
sp->installEventFilter( this );
|
||||
}
|
||||
foreach( QSlider * sp, findChildren<QSlider*>() ) {
|
||||
sp->installEventFilter( this );
|
||||
}
|
||||
disbleMouseWheelEvents();
|
||||
}
|
||||
|
||||
OutputChannelForm::~OutputChannelForm()
|
||||
@ -88,19 +79,6 @@ OutputChannelForm::~OutputChannelForm()
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
|
||||
bool OutputChannelForm::eventFilter( QObject * obj, QEvent * evt ) {
|
||||
//Filter all wheel events, and ignore them
|
||||
if ( evt->type() == QEvent::Wheel &&
|
||||
(qobject_cast<QAbstractSpinBox*>( obj ) || qobject_cast<QAbstractSlider*>( obj ) ))
|
||||
{
|
||||
evt->ignore();
|
||||
return true;
|
||||
}
|
||||
return QWidget::eventFilter( obj, evt );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Restrict UI to protect users from accidental misuse.
|
||||
*/
|
||||
|
@ -29,17 +29,15 @@
|
||||
|
||||
#include <QWidget>
|
||||
#include "ui_outputchannelform.h"
|
||||
#include "configtaskwidget.h"
|
||||
|
||||
class ConfigOnputWidget;
|
||||
|
||||
class OutputChannelForm : public QWidget
|
||||
class OutputChannelForm : public ConfigTaskWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit OutputChannelForm(const int index, QWidget *parent = NULL, const bool showLegend = false);
|
||||
~OutputChannelForm();
|
||||
bool eventFilter( QObject * obj, QEvent * evt );
|
||||
friend class ConfigOnputWidget;
|
||||
|
||||
void setAssignment(const QString &assignment);
|
||||
|
@ -1145,6 +1145,30 @@ void ConfigTaskWidget::loadWidgetLimits(QWidget * widget,UAVObjectField * field,
|
||||
}
|
||||
}
|
||||
|
||||
void ConfigTaskWidget::disbleMouseWheelEvents()
|
||||
{
|
||||
//Disable mouse wheel events
|
||||
foreach( QSpinBox * sp, findChildren<QSpinBox*>() ) {
|
||||
sp->installEventFilter( this );
|
||||
}
|
||||
foreach( QDoubleSpinBox * sp, findChildren<QDoubleSpinBox*>() ) {
|
||||
sp->installEventFilter( this );
|
||||
}
|
||||
foreach( QSlider * sp, findChildren<QSlider*>() ) {
|
||||
sp->installEventFilter( this );
|
||||
}
|
||||
}
|
||||
|
||||
bool ConfigTaskWidget::eventFilter( QObject * obj, QEvent * evt ) {
|
||||
//Filter all wheel events, and ignore them
|
||||
if ( evt->type() == QEvent::Wheel &&
|
||||
(qobject_cast<QAbstractSpinBox*>( obj ) || qobject_cast<QAbstractSlider*>( obj ) ))
|
||||
{
|
||||
evt->ignore();
|
||||
return true;
|
||||
}
|
||||
return QWidget::eventFilter( obj, evt );
|
||||
}
|
||||
/**
|
||||
@}
|
||||
@}
|
||||
|
@ -46,6 +46,7 @@
|
||||
#include "uavobjectwidgetutils_global.h"
|
||||
#include <QDesktopServices>
|
||||
#include <QUrl>
|
||||
#include <QEvent>
|
||||
|
||||
class UAVOBJECTWIDGETUTILS_EXPORT ConfigTaskWidget: public QWidget
|
||||
{
|
||||
@ -85,6 +86,9 @@ public:
|
||||
ConfigTaskWidget(QWidget *parent = 0);
|
||||
~ConfigTaskWidget();
|
||||
|
||||
void disbleMouseWheelEvents();
|
||||
bool eventFilter( QObject * obj, QEvent * evt );
|
||||
|
||||
void saveObjectToSD(UAVObject *obj);
|
||||
UAVObjectManager* getObjectManager();
|
||||
static double listMean(QList<double> list);
|
||||
|
Loading…
Reference in New Issue
Block a user