]> SALOME platform Git repositories - modules/shaper.git/blob - src/ModuleBase/ModuleBase_WidgetFeature.h
Salome HOME
Merge branch 'master' of newgeom:newgeom
[modules/shaper.git] / src / ModuleBase / ModuleBase_WidgetFeature.h
1 // File:        ModuleBase_WidgetFeature.h
2 // Created:     25 Apr 2014
3 // Author:      Natalia ERMOLAEVA
4
5 #ifndef ModuleBase_WidgetFeature_H
6 #define ModuleBase_WidgetFeature_H
7
8 #include <ModuleBase.h>
9 #include "ModuleBase_ModelWidget.h"
10
11 #include <QObject>
12 #include <QStringList>
13
14 class ModelAPI_Feature;
15 class QWidget;
16 class QLabel;
17 class QLineEdit;
18
19 /**\class ModuleBase_WidgetFeature
20  * \ingroup GUI
21  * \brief Custom widget. An abstract class to be redefined to fill with some GUI controls
22  */
23 class MODULEBASE_EXPORT ModuleBase_WidgetFeature : public ModuleBase_ModelWidget
24 {
25   Q_OBJECT
26 public:
27   /// Constructor
28   /// \theParent the parent object
29   /// \theParent the parent object
30   /// \theData the widget configuation. The attribute of the model widget is obtained from
31   ModuleBase_WidgetFeature(QWidget* theParent, const Config_WidgetAPI* theData);
32   /// Destructor
33   virtual ~ModuleBase_WidgetFeature();
34
35   /// Fill the widget values by given point
36   /// \param thePoint the point
37   bool setFeature(const FeaturePtr& theFeature);
38
39   /// Saves the internal parameters to the given feature
40   /// \param theFeature a model feature to be changed
41   virtual bool storeValue(FeaturePtr theFeature) const;
42
43   virtual bool restoreValue(FeaturePtr theFeature);
44
45   /// Returns the internal parent wiget control, that can be shown anywhere
46   /// \returns the widget
47   QWidget* getControl() const;
48
49   /// Returns list of widget controls
50   /// \return a control list
51   virtual QList<QWidget*> getControls() const;
52
53 private:
54   FeaturePtr myFeature; ///< the current widget feature
55   QStringList myFeatureKinds; ///< the kinds of possible features
56
57   QWidget*   myContainer; /// the parent top control
58   QLabel*    myLabel; /// the editor information label
59   QLineEdit* myEditor; ///< the feature editor to visualize the feature name
60 };
61
62 #endif