1 // File: ModuleBase_WidgetFeature.h
2 // Created: 25 Apr 2014
3 // Author: Natalia ERMOLAEVA
5 #ifndef ModuleBase_WidgetFeature_H
6 #define ModuleBase_WidgetFeature_H
8 #include <ModuleBase.h>
9 #include "ModuleBase_ModelWidget.h"
12 #include <QStringList>
14 class ModuleBase_WidgetValue;
15 class ModelAPI_Feature;
21 /**\class ModuleBase_WidgetFeature
23 * \brief Custom widget. An abstract class to be redefined to fill with some GUI controls
25 class MODULEBASE_EXPORT ModuleBase_WidgetFeature : public ModuleBase_ModelWidget
30 /// \theParent the parent object
31 /// \theParent the parent object
32 /// \theData the widget configuation. The attribute of the model widget is obtained from
33 ModuleBase_WidgetFeature(QWidget* theParent, const Config_WidgetAPI* theData,
34 const std::string& theParentId);
36 virtual ~ModuleBase_WidgetFeature();
38 /// Set the given wrapped value to the current widget
39 /// This value should be processed in the widget according to the needs
40 /// \param theValue the wrapped widget value
41 virtual bool setValue(ModuleBase_WidgetValue* theValue);
43 /// Saves the internal parameters to the given feature
44 /// \param theFeature a model feature to be changed
45 virtual bool storeValue() const;
47 virtual bool restoreValue();
49 /// Returns the internal parent wiget control, that can be shown anywhere
50 /// \returns the widget
51 QWidget* getControl() const;
53 /// Returns list of widget controls
54 /// \return a control list
55 virtual QList<QWidget*> getControls() const;
56 /// Defines if it is supposed that the widget should interact with the viewer.
57 virtual bool isViewerSelector() { return true; }
60 /// Fill the widget values by given point
61 /// \param thePoint the point
62 /// \return the boolean result of the feature set
63 bool setObject(const ObjectPtr& theObject, bool theSendEvent = true);
65 /// Returns current widget feature
66 /// \return the feature
67 const ObjectPtr object() const
72 /// Returns the widget editor
73 /// \return the editor
74 QLineEdit* editor() const
79 /// Returns the possible feature kinds
80 /// \return the list of kinds
81 const QStringList& featureKinds() const
87 ObjectPtr myObject; ///< the current widget feature
88 QStringList myObjectKinds; ///< the kinds of possible features
91 QWidget* myContainer; /// the parent top control
92 QLabel* myLabel; /// the editor information label
93 QLineEdit* myEditor; ///< the feature editor to visualize the feature name