Salome HOME
Point2d Distance widget added
[modules/shaper.git] / src / ModuleBase / ModuleBase_WidgetDoubleValue.h
1 // File:        ModuleBase_WidgetDoubleValue.h
2 // Created:     04 June 2014
3 // Author:      Vitaly Smetannikov
4
5 #ifndef ModuleBase_WidgetDoubleValue_H
6 #define ModuleBase_WidgetDoubleValue_H
7
8 #include "ModuleBase.h"
9 #include "ModuleBase_ModelWidget.h"
10
11 class Config_WidgetAPI;
12 class QWidget;
13 class QLabel;
14 class QDoubleSpinBox;
15
16 class MODULEBASE_EXPORT ModuleBase_WidgetDoubleValue: public ModuleBase_ModelWidget
17 {
18   Q_OBJECT
19 public:
20   /// Constructor
21   /// \theParent the parent object
22   /// \theData the widget configuation. The attribute of the model widget is obtained from
23   ModuleBase_WidgetDoubleValue(QWidget* theParent, const Config_WidgetAPI* theData);
24
25   virtual ~ModuleBase_WidgetDoubleValue();
26
27   /// Saves the internal parameters to the given feature
28   /// \param theFeature a model feature to be changed
29   virtual bool storeValue(FeaturePtr theFeature) const;
30
31   virtual bool restoreValue(FeaturePtr theFeature);
32
33   /// Returns list of widget controls
34   /// \return a control list
35   virtual QList<QWidget*> getControls() const;
36
37   /// Returns the internal parent wiget control, that can be shown anywhere
38   /// \returns the widget
39   QWidget* getControl() const { return myContainer; }
40
41   /// Process key release envent on the widget spin box controls
42   /// \param theObject the object where the event happens
43   /// \param theEvent the processed event
44   virtual bool eventFilter(QObject *theObject, QEvent *theEvent);
45
46 protected:
47   QWidget*     myContainer;
48   QLabel*      myLabel;
49   QDoubleSpinBox* mySpinBox;
50 };
51
52 #endif