Salome HOME
6c819866e8575bd6f2bbc6164c4293deca7f53d2
[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                                const std::string& theParentId);
25
26   virtual ~ModuleBase_WidgetDoubleValue();
27
28   /// Saves the internal parameters to the given feature
29   /// \param theObject a model feature to be changed
30   virtual bool storeValue() const;
31
32   virtual bool restoreValue();
33
34   /// Returns list of widget controls
35   /// \return a control list
36   virtual QList<QWidget*> getControls() const;
37
38   /// Returns the internal parent wiget control, that can be shown anywhere
39   /// \returns the widget
40   QWidget* getControl() const
41   {
42     return myContainer;
43   }
44
45   /// Process key release envent on the widget spin box controls
46   /// \param theObject the object where the event happens
47   /// \param theEvent the processed event
48   virtual bool eventFilter(QObject *theObject, QEvent *theEvent);
49
50  protected:
51   QWidget* myContainer;
52   QLabel* myLabel;
53   QDoubleSpinBox* mySpinBox;
54 };
55
56 #endif