1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
3 // File: ParametersPlugin_WidgetParamsMgr.h
4 // Created: 11 Apr 2016
5 // Author: Vitaly SMETANNIKOV
7 #ifndef ParametersPlugin_WidgetParamsMgr_H_
8 #define ParametersPlugin_WidgetParamsMgr_H_
10 #include <ModuleBase_ModelWidget.h>
11 #include <QModelIndex>
12 #include <QAbstractItemDelegate>
15 class QTreeWidgetItem;
16 class ParametersPlugin_ItemDelegate;
22 * Represent a content of the property panel to show/modify parameters of some feature.
24 class ParametersPlugin_WidgetParamsMgr : public ModuleBase_ModelWidget
28 /// Constructs a model widget
29 ParametersPlugin_WidgetParamsMgr(QWidget* theParent, const Config_WidgetAPI* theData);
31 /// Destructs the model widget
32 virtual ~ParametersPlugin_WidgetParamsMgr() {}
34 /// Returns list of widget controls
35 /// \return a control list
36 virtual QList<QWidget*> getControls() const;
39 /// Saves the internal parameters to the given feature
40 /// \return True in success
41 virtual bool storeValueCustom();
43 /// Restore value from attribute data to the widget's control
44 virtual bool restoreValueCustom();
46 /// The method called when widget is activated
47 virtual void activateCustom();
50 /// Slot for reaction on double click in the table (start editing)
51 /// \param theIndex the clicked index
52 void onDoubleClick(const QModelIndex& theIndex);
54 /// Slot for reaction on end of cell editing
55 /// \param theEditor the editor widget
56 /// \param theHint end of edit type
57 void onCloseEditor(QWidget* theEditor, QAbstractItemDelegate::EndEditHint theHint);
59 /// Slot for reaction on add parameter
62 /// Slot for reaction on insert parameter
65 /// Slot for reaction on remove parameter
68 /// Slot for reaction on shift up
71 /// Slot for reaction on shift down
76 void onSelectionChanged();
79 FeaturePtr createParameter() const;
80 QTreeWidgetItem* createNewItem() const;
81 QTreeWidgetItem* selectedItem() const;
82 void selectItemScroll(QTreeWidgetItem* aItem);
84 void updateFeaturesPart();
86 bool hasName(const QString& theName) const;
89 QTreeWidgetItem* myFeatures;
90 QTreeWidgetItem* myParameters;
91 ParametersPlugin_ItemDelegate* myDelegate;
92 QModelIndex myEditingIndex;
94 QList<FeaturePtr> myParametersList;
98 QPushButton* myAddBtn;
99 QPushButton* myInsertBtn;
100 QPushButton* myRemoveBtn;
101 QToolButton* myUpBtn;
102 QToolButton* myDownBtn;