#include <QLayout>
#include <QLabel>
#include <QDoubleSpinBox>
+#include <QEvent>
+#include <QKeyEvent>
ModuleBase_WidgetDoubleValue::ModuleBase_WidgetDoubleValue(QWidget* theParent, const Config_WidgetAPI* theData)
aControlLay->setStretch(1, 1);
connect(mySpinBox, SIGNAL(valueChanged(double)), this, SIGNAL(valuesChanged()));
+
+ mySpinBox->installEventFilter(this);
}
ModuleBase_WidgetDoubleValue::~ModuleBase_WidgetDoubleValue()
aList.append(mySpinBox);
return aList;
}
+
+bool ModuleBase_WidgetDoubleValue::eventFilter(QObject *theObject, QEvent *theEvent)
+{
+ if (theObject == mySpinBox) {
+ if (theEvent->type() == QEvent::KeyRelease) {
+ emit keyReleased(attributeID(), (QKeyEvent*) theEvent);
+ return true;
+ }
+ }
+ return ModuleBase_ModelWidget::eventFilter(theObject, theEvent);
+}
/// \returns the widget
QWidget* getControl() const { return myContainer; }
+ /// Process key release envent on the widget spin box controls
+ /// \param theObject the object where the event happens
+ /// \param theEvent the processed event
+ virtual bool eventFilter(QObject *theObject, QEvent *theEvent);
+
private:
QWidget* myContainer;
QLabel* myLabel;
/// \return a control list
virtual QList<QWidget*> getControls() const;
+ /// Process key release envent on the widget spin box controls
+ /// \param theObject the object where the event happens
+ /// \param theEvent the processed event
virtual bool eventFilter(QObject *theObject, QEvent *theEvent);
private: