mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-02 10:24:11 +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->camerastabilizationSaveSD, SIGNAL(clicked()), this, SLOT(saveSettings()));
|
||||||
connect(m_camerastabilization->camerastabilizationHelp, SIGNAL(clicked()), this, SLOT(openHelp()));
|
connect(m_camerastabilization->camerastabilizationHelp, SIGNAL(clicked()), this, SLOT(openHelp()));
|
||||||
|
|
||||||
//Disable mouse wheel events
|
disbleMouseWheelEvents();
|
||||||
foreach( QSpinBox * sp, findChildren<QSpinBox*>() ) {
|
|
||||||
sp->installEventFilter( this );
|
|
||||||
}
|
|
||||||
foreach( QDoubleSpinBox * sp, findChildren<QDoubleSpinBox*>() ) {
|
|
||||||
sp->installEventFilter( this );
|
|
||||||
}
|
|
||||||
foreach( QSlider * sp, findChildren<QSlider*>() ) {
|
|
||||||
sp->installEventFilter( this );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfigCameraStabilizationWidget::~ConfigCameraStabilizationWidget()
|
ConfigCameraStabilizationWidget::~ConfigCameraStabilizationWidget()
|
||||||
@ -107,19 +98,6 @@ ConfigCameraStabilizationWidget::~ConfigCameraStabilizationWidget()
|
|||||||
// Do nothing
|
// 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()
|
void ConfigCameraStabilizationWidget::connectUpdates()
|
||||||
{
|
{
|
||||||
// Now connect the widget to the StabilizationSettings object
|
// Now connect the widget to the StabilizationSettings object
|
||||||
|
@ -41,7 +41,6 @@ class ConfigCameraStabilizationWidget: public ConfigTaskWidget
|
|||||||
public:
|
public:
|
||||||
ConfigCameraStabilizationWidget(QWidget *parent = 0);
|
ConfigCameraStabilizationWidget(QWidget *parent = 0);
|
||||||
~ConfigCameraStabilizationWidget();
|
~ConfigCameraStabilizationWidget();
|
||||||
bool eventFilter( QObject * obj, QEvent * evt );
|
|
||||||
private:
|
private:
|
||||||
Ui_CameraStabilizationWidget *m_camerastabilization;
|
Ui_CameraStabilizationWidget *m_camerastabilization;
|
||||||
virtual void enableControls(bool enable);
|
virtual void enableControls(bool enable);
|
||||||
|
@ -53,17 +53,7 @@ ConfigStabilizationWidget::ConfigStabilizationWidget(QWidget *parent) : ConfigTa
|
|||||||
|
|
||||||
connect(this,SIGNAL(widgetContentsChanged(QWidget*)),this,SLOT(processLinkedWidgets(QWidget*)));
|
connect(this,SIGNAL(widgetContentsChanged(QWidget*)),this,SLOT(processLinkedWidgets(QWidget*)));
|
||||||
|
|
||||||
//Disable mouse wheel events
|
disbleMouseWheelEvents();
|
||||||
foreach( QSpinBox * sp, findChildren<QSpinBox*>() ) {
|
|
||||||
sp->installEventFilter( this );
|
|
||||||
}
|
|
||||||
foreach( QDoubleSpinBox * sp, findChildren<QDoubleSpinBox*>() ) {
|
|
||||||
sp->installEventFilter( this );
|
|
||||||
}
|
|
||||||
foreach( QSlider * sp, findChildren<QSlider*>() ) {
|
|
||||||
sp->installEventFilter( this );
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -72,19 +62,6 @@ ConfigStabilizationWidget::~ConfigStabilizationWidget()
|
|||||||
// Do nothing
|
// 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)
|
void ConfigStabilizationWidget::realtimeUpdatesSlot(int value)
|
||||||
{
|
{
|
||||||
m_stabilization->realTimeUpdates_6->setCheckState((Qt::CheckState)value);
|
m_stabilization->realTimeUpdates_6->setCheckState((Qt::CheckState)value);
|
||||||
|
@ -44,7 +44,6 @@ class ConfigStabilizationWidget: public ConfigTaskWidget
|
|||||||
public:
|
public:
|
||||||
ConfigStabilizationWidget(QWidget *parent = 0);
|
ConfigStabilizationWidget(QWidget *parent = 0);
|
||||||
~ConfigStabilizationWidget();
|
~ConfigStabilizationWidget();
|
||||||
bool eventFilter( QObject * o, QEvent * e );
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui_StabilizationWidget *m_stabilization;
|
Ui_StabilizationWidget *m_stabilization;
|
||||||
|
@ -68,16 +68,7 @@ ConfigTxPIDWidget::ConfigTxPIDWidget(QWidget *parent) : ConfigTaskWidget(parent)
|
|||||||
populateWidgets();
|
populateWidgets();
|
||||||
refreshWidgetsValues();
|
refreshWidgetsValues();
|
||||||
|
|
||||||
//Disable mouse wheel events
|
disbleMouseWheelEvents();
|
||||||
foreach( QSpinBox * sp, findChildren<QSpinBox*>() ) {
|
|
||||||
sp->installEventFilter( this );
|
|
||||||
}
|
|
||||||
foreach( QDoubleSpinBox * sp, findChildren<QDoubleSpinBox*>() ) {
|
|
||||||
sp->installEventFilter( this );
|
|
||||||
}
|
|
||||||
foreach( QSlider * sp, findChildren<QSlider*>() ) {
|
|
||||||
sp->installEventFilter( this );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfigTxPIDWidget::~ConfigTxPIDWidget()
|
ConfigTxPIDWidget::~ConfigTxPIDWidget()
|
||||||
@ -85,19 +76,6 @@ ConfigTxPIDWidget::~ConfigTxPIDWidget()
|
|||||||
// Do nothing
|
// 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()
|
void ConfigTxPIDWidget::refreshValues()
|
||||||
{
|
{
|
||||||
HwSettings *hwSettings = HwSettings::GetInstance(getObjectManager());
|
HwSettings *hwSettings = HwSettings::GetInstance(getObjectManager());
|
||||||
|
@ -37,7 +37,6 @@ class ConfigTxPIDWidget : public ConfigTaskWidget
|
|||||||
public:
|
public:
|
||||||
ConfigTxPIDWidget(QWidget *parent = 0);
|
ConfigTxPIDWidget(QWidget *parent = 0);
|
||||||
~ConfigTxPIDWidget();
|
~ConfigTxPIDWidget();
|
||||||
bool eventFilter( QObject * obj, QEvent * evt );
|
|
||||||
private:
|
private:
|
||||||
Ui_TxPIDWidget *m_txpid;
|
Ui_TxPIDWidget *m_txpid;
|
||||||
|
|
||||||
|
@ -233,16 +233,7 @@ ConfigVehicleTypeWidget::ConfigVehicleTypeWidget(QWidget *parent) : ConfigTaskWi
|
|||||||
setupGroundVehicleUI( m_aircraft->groundVehicleType->currentText() );
|
setupGroundVehicleUI( m_aircraft->groundVehicleType->currentText() );
|
||||||
setupFixedWingUI( m_aircraft->fixedWingType->currentText() );
|
setupFixedWingUI( m_aircraft->fixedWingType->currentText() );
|
||||||
|
|
||||||
//Disable mouse wheel events
|
disbleMouseWheelEvents();
|
||||||
foreach( QSpinBox * sp, findChildren<QSpinBox*>() ) {
|
|
||||||
sp->installEventFilter( this );
|
|
||||||
}
|
|
||||||
foreach( QDoubleSpinBox * sp, findChildren<QDoubleSpinBox*>() ) {
|
|
||||||
sp->installEventFilter( this );
|
|
||||||
}
|
|
||||||
foreach( QSlider * sp, findChildren<QSlider*>() ) {
|
|
||||||
sp->installEventFilter( this );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -254,19 +245,6 @@ ConfigVehicleTypeWidget::~ConfigVehicleTypeWidget()
|
|||||||
// Do nothing
|
// 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
|
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.
|
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:
|
public:
|
||||||
ConfigVehicleTypeWidget(QWidget *parent = 0);
|
ConfigVehicleTypeWidget(QWidget *parent = 0);
|
||||||
~ConfigVehicleTypeWidget();
|
~ConfigVehicleTypeWidget();
|
||||||
bool eventFilter( QObject * obj, QEvent * evt );
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui_AircraftWidget *m_aircraft;
|
Ui_AircraftWidget *m_aircraft;
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include "manualcontrolsettings.h"
|
#include "manualcontrolsettings.h"
|
||||||
|
|
||||||
inputChannelForm::inputChannelForm(QWidget *parent,bool showlegend) :
|
inputChannelForm::inputChannelForm(QWidget *parent,bool showlegend) :
|
||||||
QWidget(parent),
|
ConfigTaskWidget(parent),
|
||||||
ui(new Ui::inputChannelForm)
|
ui(new Ui::inputChannelForm)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
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->channelNumberDropdown,SIGNAL(currentIndexChanged(int)),this,SLOT(channelDropdownUpdated(int)));
|
||||||
connect(ui->channelNumber,SIGNAL(valueChanged(int)),this,SLOT(channelNumberUpdated(int)));
|
connect(ui->channelNumber,SIGNAL(valueChanged(int)),this,SLOT(channelNumberUpdated(int)));
|
||||||
|
|
||||||
//Disable mouse wheel events
|
disbleMouseWheelEvents();
|
||||||
foreach( QSpinBox * sp, findChildren<QSpinBox*>() ) {
|
|
||||||
sp->installEventFilter( this );
|
|
||||||
}
|
|
||||||
foreach( QDoubleSpinBox * sp, findChildren<QDoubleSpinBox*>() ) {
|
|
||||||
sp->installEventFilter( this );
|
|
||||||
}
|
|
||||||
foreach( QSlider * sp, findChildren<QSlider*>() ) {
|
|
||||||
sp->installEventFilter( this );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -55,19 +46,6 @@ inputChannelForm::~inputChannelForm()
|
|||||||
delete ui;
|
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)
|
void inputChannelForm::setName(QString &name)
|
||||||
{
|
{
|
||||||
ui->channelName->setText(name);
|
ui->channelName->setText(name);
|
||||||
|
@ -7,14 +7,13 @@ namespace Ui {
|
|||||||
class inputChannelForm;
|
class inputChannelForm;
|
||||||
}
|
}
|
||||||
|
|
||||||
class inputChannelForm : public QWidget
|
class inputChannelForm : public ConfigTaskWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit inputChannelForm(QWidget *parent = 0,bool showlegend=false);
|
explicit inputChannelForm(QWidget *parent = 0,bool showlegend=false);
|
||||||
~inputChannelForm();
|
~inputChannelForm();
|
||||||
bool eventFilter( QObject * obj, QEvent * evt );
|
|
||||||
friend class ConfigInputWidget;
|
friend class ConfigInputWidget;
|
||||||
void setName(QString &name);
|
void setName(QString &name);
|
||||||
private slots:
|
private slots:
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
#include "configoutputwidget.h"
|
#include "configoutputwidget.h"
|
||||||
|
|
||||||
OutputChannelForm::OutputChannelForm(const int index, QWidget *parent, const bool showLegend) :
|
OutputChannelForm::OutputChannelForm(const int index, QWidget *parent, const bool showLegend) :
|
||||||
QWidget(parent),
|
ConfigTaskWidget(parent),
|
||||||
ui(),
|
ui(),
|
||||||
m_index(index),
|
m_index(index),
|
||||||
m_inChannelTest(false)
|
m_inChannelTest(false)
|
||||||
@ -71,16 +71,7 @@ OutputChannelForm::OutputChannelForm(const int index, QWidget *parent, const boo
|
|||||||
connect(ui.actuatorLink, SIGNAL(toggled(bool)),
|
connect(ui.actuatorLink, SIGNAL(toggled(bool)),
|
||||||
this, SLOT(linkToggled(bool)));
|
this, SLOT(linkToggled(bool)));
|
||||||
|
|
||||||
//Disable mouse wheel events
|
disbleMouseWheelEvents();
|
||||||
foreach( QSpinBox * sp, findChildren<QSpinBox*>() ) {
|
|
||||||
sp->installEventFilter( this );
|
|
||||||
}
|
|
||||||
foreach( QDoubleSpinBox * sp, findChildren<QDoubleSpinBox*>() ) {
|
|
||||||
sp->installEventFilter( this );
|
|
||||||
}
|
|
||||||
foreach( QSlider * sp, findChildren<QSlider*>() ) {
|
|
||||||
sp->installEventFilter( this );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
OutputChannelForm::~OutputChannelForm()
|
OutputChannelForm::~OutputChannelForm()
|
||||||
@ -88,19 +79,6 @@ OutputChannelForm::~OutputChannelForm()
|
|||||||
// Do nothing
|
// 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.
|
* Restrict UI to protect users from accidental misuse.
|
||||||
*/
|
*/
|
||||||
|
@ -29,17 +29,15 @@
|
|||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include "ui_outputchannelform.h"
|
#include "ui_outputchannelform.h"
|
||||||
|
#include "configtaskwidget.h"
|
||||||
|
|
||||||
class ConfigOnputWidget;
|
class OutputChannelForm : public ConfigTaskWidget
|
||||||
|
|
||||||
class OutputChannelForm : public QWidget
|
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit OutputChannelForm(const int index, QWidget *parent = NULL, const bool showLegend = false);
|
explicit OutputChannelForm(const int index, QWidget *parent = NULL, const bool showLegend = false);
|
||||||
~OutputChannelForm();
|
~OutputChannelForm();
|
||||||
bool eventFilter( QObject * obj, QEvent * evt );
|
|
||||||
friend class ConfigOnputWidget;
|
friend class ConfigOnputWidget;
|
||||||
|
|
||||||
void setAssignment(const QString &assignment);
|
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 "uavobjectwidgetutils_global.h"
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
#include <QEvent>
|
||||||
|
|
||||||
class UAVOBJECTWIDGETUTILS_EXPORT ConfigTaskWidget: public QWidget
|
class UAVOBJECTWIDGETUTILS_EXPORT ConfigTaskWidget: public QWidget
|
||||||
{
|
{
|
||||||
@ -85,6 +86,9 @@ public:
|
|||||||
ConfigTaskWidget(QWidget *parent = 0);
|
ConfigTaskWidget(QWidget *parent = 0);
|
||||||
~ConfigTaskWidget();
|
~ConfigTaskWidget();
|
||||||
|
|
||||||
|
void disbleMouseWheelEvents();
|
||||||
|
bool eventFilter( QObject * obj, QEvent * evt );
|
||||||
|
|
||||||
void saveObjectToSD(UAVObject *obj);
|
void saveObjectToSD(UAVObject *obj);
|
||||||
UAVObjectManager* getObjectManager();
|
UAVObjectManager* getObjectManager();
|
||||||
static double listMean(QList<double> list);
|
static double listMean(QList<double> list);
|
||||||
|
Loading…
Reference in New Issue
Block a user