Salome HOME
Merge branch 'Dev_1.1.0' of newgeom:newgeom into Dev_1.1.0
[modules/shaper.git] / src / ModuleBase / ModuleBase_WidgetLabel.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        ModuleBase_WidgetLabel.h
4 // Created:     03 Dec 2014
5 // Author:      Vitaly SMETANNIKOV
6
7 #ifndef ModuleBase_WidgetLabel_H
8 #define ModuleBase_WidgetLabel_H
9
10 #include "ModuleBase.h"
11 #include "ModuleBase_ModelWidget.h"
12
13 class QLabel;
14
15 /**
16 * \ingroup GUI
17 * Implementation of model widget for a label control
18 */
19 class MODULEBASE_EXPORT ModuleBase_WidgetLabel : public ModuleBase_ModelWidget
20 {
21 Q_OBJECT
22  public:
23   /// Constructor
24   /// \param theParent the parent object
25   /// \param theData the widget configuation. The attribute of the model widget is obtained from
26   /// \param theParentId is Id of a parent of the current attribute
27   ModuleBase_WidgetLabel(QWidget* theParent, const Config_WidgetAPI* theData,
28                             const std::string& theParentId);
29
30   virtual ~ModuleBase_WidgetLabel();
31
32   /// Defines if it is supported to set the value in this widget
33   /// It returns false because this is an info widget
34   virtual bool canSetValue() const { return false; };
35
36   virtual bool restoreValue()
37   {
38     return true;
39   }
40
41   virtual QList<QWidget*> getControls() const;
42
43   QWidget* getControl() const;
44
45   /// This control doesn't accept focus
46   virtual bool focusTo() { return false; }
47
48 protected:
49   /// Saves the internal parameters to the given feature
50   /// \return True in success
51   virtual bool storeValueCustom() const
52   {
53     return true;
54   }
55
56 private:
57   /// A label control
58   QLabel* myLabel;
59 };
60
61 #endif