Salome HOME
Fix for selection with 'N' key and update documentation
[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 * \ingroup GUI
21 * A class of property panel widget for double value input
22 * It can be defined with "doublevalue" keyword. For example:
23 * \code
24 * <doublevalue id="x" label="X:" icon=":pictures/x_point.png" tooltip="X coordinate"/>
25 * \endcode
26 */
27 class MODULEBASE_EXPORT ModuleBase_WidgetDoubleValue : public ModuleBase_ModelWidget
28 {
29 Q_OBJECT
30  public:
31   /// Constructor
32   /// \param theParent the parent object
33   /// \param theData the widget configuation. The attribute of the model widget is obtained from
34   /// \param theParentId is Id of a parent structure (widget, operation, group)
35   ModuleBase_WidgetDoubleValue(QWidget* theParent, const Config_WidgetAPI* theData,
36                                const std::string& theParentId);
37
38   virtual ~ModuleBase_WidgetDoubleValue();
39
40   //! Saves the internal parameters to the given feature
41   // \return True in success
42   virtual bool storeValue() const;
43
44   //! Read value of corresponded attribute from data model to the input control
45   // \return True in success
46   virtual bool restoreValue();
47
48   /// Returns list of widget controls
49   /// \return a control list
50   virtual QList<QWidget*> getControls() const;
51
52   /// Returns the internal parent wiget control, that can be shown anywhere
53   /// \returns the widget
54   QWidget* getControl() const
55   {
56     return myContainer;
57   }
58
59  public slots:
60  // Delayed value chnged: when user starts typing something,
61  // it gives him a 0,5 second to finish typing, when sends valueChnaged() signal
62 //  void onValueChanged();
63
64  protected:
65    /// Container for thw widget controls
66   QWidget* myContainer;
67
68   /// Label of the widget
69   QLabel* myLabel;
70
71   /// Input value control
72   ModuleBase_DoubleSpinBox* mySpinBox;
73 };
74
75 #endif