Salome HOME
1. Correction for perfomance problem by Apply button state update: do not listen...
[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_ParamSpinBox;
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   ModuleBase_WidgetDoubleValue(QWidget* theParent, const Config_WidgetAPI* theData);
35
36   virtual ~ModuleBase_WidgetDoubleValue();
37
38   /// The methiod called when widget is activated
39   virtual void activateCustom();
40
41   /// Select the internal content if it can be selected. It is empty in the default realization
42   virtual void selectContent();
43
44   /// Returns list of widget controls
45   /// \return a control list
46   virtual QList<QWidget*> getControls() const;
47
48   /// Returns true if the event is processed.
49   virtual bool processEnter();
50
51  public slots:
52  // Delayed value chnged: when user starts typing something,
53  // it gives him a 0,5 second to finish typing, when sends valueChnaged() signal
54 //  void onValueChanged();
55
56 protected:
57   /// Saves the internal parameters to the given feature
58   /// \return True in success
59   virtual bool storeValueCustom();
60
61   //! Read value of corresponded attribute from data model to the input control
62   // \return True in success
63   virtual bool restoreValueCustom();
64
65   /// Fills the widget with default values
66   /// \return true if the widget current value is reset
67   virtual bool resetCustom();
68
69 protected:
70   /// Label of the widget
71   QLabel* myLabel;
72
73   /// Input value control
74   ModuleBase_ParamSpinBox* mySpinBox;
75 };
76
77 #endif