Salome HOME
aba839b9ff68d673d3c350ba878899b7d1a7c39e
[modules/shaper.git] / src / ParametersPlugin / ParametersPlugin_WidgetParamsMgr.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
2
3 // File:        ParametersPlugin_WidgetParamsMgr.h
4 // Created:     11 Apr 2016
5 // Author:      Vitaly SMETANNIKOV
6
7 #ifndef ParametersPlugin_WidgetParamsMgr_H_
8 #define ParametersPlugin_WidgetParamsMgr_H_
9
10 #include <ModuleBase_ModelWidget.h>
11 #include <QModelIndex>
12 #include <QAbstractItemDelegate>
13
14 class QTreeWidget;
15 class QTreeWidgetItem;
16 class ParametersPlugin_ItemDelegate;
17
18 /*!
19  * \ingroup GUI
20  * Represent a content of the property panel to show/modify parameters of some feature.
21  */
22 class ParametersPlugin_WidgetParamsMgr : public ModuleBase_ModelWidget
23 {
24  Q_OBJECT
25 public:
26   /// Constructs a model widget
27   ParametersPlugin_WidgetParamsMgr(QWidget* theParent, const Config_WidgetAPI* theData);
28
29   /// Destructs the model widget
30   virtual ~ParametersPlugin_WidgetParamsMgr() {}
31
32   /// Returns list of widget controls
33   /// \return a control list
34   virtual QList<QWidget*> getControls() const;
35
36 protected:
37   /// Saves the internal parameters to the given feature
38   /// \return True in success
39   virtual bool storeValueCustom() const;
40
41   /// Restore value from attribute data to the widget's control
42   virtual bool restoreValueCustom();
43
44   /// The method called when widget is activated
45   virtual void activateCustom();
46
47 private slots:
48   void onDoubleClick(const QModelIndex&);
49   void onCloseEditor(QWidget* theEditor, QAbstractItemDelegate::EndEditHint theHint);
50
51 private:
52
53   QTreeWidget* myTable;
54   QTreeWidgetItem* myFeatures;
55   QTreeWidgetItem* myParameters;
56   ParametersPlugin_ItemDelegate* myDelegate;
57   QModelIndex myEditingIndex;
58
59   QList<FeaturePtr> myFeatureList;
60 };
61
62
63 #endif