Salome HOME
Code documentation update
[modules/shaper.git] / src / ModuleBase / ModuleBase_WidgetDoubleValue.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        ModuleBase_WidgetDoubleValue.h
4 // Created:     04 June 2014
5 // Author:      Vitaly Smetannikov
6
7 #ifndef ModuleBase_WidgetDoubleValue_H
8 #define ModuleBase_WidgetDoubleValue_H
9
10 #include "ModuleBase.h"
11 #include "ModuleBase_ModelWidget.h"
12
13 class ModuleBase_DoubleSpinBox;
14 class Config_WidgetAPI;
15 class QWidget;
16 class QLabel;
17 class QTimer;
18
19 /**
20 * A class of property panel widget for double value input
21 * It can be defined with "doublevalue" keyword. For example:
22 * \code
23 * <doublevalue id="x" label="X:" icon=":pictures/x_point.png" tooltip="X coordinate"/>
24 * \endcode
25 */
26 class MODULEBASE_EXPORT ModuleBase_WidgetDoubleValue : public ModuleBase_ModelWidget
27 {
28 Q_OBJECT
29  public:
30   /// Constructor
31   /// \param theParent the parent object
32   /// \param theData the widget configuation. The attribute of the model widget is obtained from
33   /// \param theParentId is Id of a parent structure (widget, operation, group)
34   ModuleBase_WidgetDoubleValue(QWidget* theParent, const Config_WidgetAPI* theData,
35                                const std::string& theParentId);
36
37   virtual ~ModuleBase_WidgetDoubleValue();
38
39   //! Saves the internal parameters to the given feature
40   // \return True in success
41   virtual bool storeValue() const;
42
43   //! Read value of corresponded attribute from data model to the input control
44   // \return True in success
45   virtual bool restoreValue();
46
47   /// Returns list of widget controls
48   /// \return a control list
49   virtual QList<QWidget*> getControls() const;
50
51   /// Returns the internal parent wiget control, that can be shown anywhere
52   /// \returns the widget
53   QWidget* getControl() const
54   {
55     return myContainer;
56   }
57
58  public slots:
59  // Delayed value chnged: when user starts typing something,
60  // it gives him a 0,5 second to finish typing, when sends valueChnaged() signal
61 //  void onValueChanged();
62
63  protected:
64    /// Container for thw widget controls
65   QWidget* myContainer;
66
67   /// Label of the widget
68   QLabel* myLabel;
69
70   /// Input value control
71   ModuleBase_DoubleSpinBox* mySpinBox;
72 };
73
74 #endif