SHAPER 9.16.0
ParametersPlugin_WidgetParamsMgr.h
1// Copyright (C) 2014-2026 CEA, EDF
2//
3// This library is free software; you can redistribute it and/or
4// modify it under the terms of the GNU Lesser General Public
5// License as published by the Free Software Foundation; either
6// version 2.1 of the License, or (at your option) any later version.
7//
8// This library is distributed in the hope that it will be useful,
9// but WITHOUT ANY WARRANTY; without even the implied warranty of
10// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11// Lesser General Public License for more details.
12//
13// You should have received a copy of the GNU Lesser General Public
14// License along with this library; if not, write to the Free Software
15// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16//
17// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18//
19
20#ifndef ParametersPlugin_WidgetParamsMgr_H_
21#define ParametersPlugin_WidgetParamsMgr_H_
22
23#include <ModuleBase_ModelDialogWidget.h>
24#include <QModelIndex>
25#include <QAbstractItemDelegate>
26#include <QTreeWidget>
27
28class QTreeWidgetItem;
30class QPushButton;
31class QToolButton;
33
39{
40 Q_OBJECT
41public:
44 ParametersPlugin_TreeWidget(QWidget* theParent = 0) : QTreeWidget(theParent) {}
45
46protected slots:
50 virtual void closeEditor(QWidget* theEditor, QAbstractItemDelegate::EndEditHint theHint);
51};
52
53
54
60{
61 Q_OBJECT
62public:
65 ModuleBase_IWorkshop* theWorkshop);
66
69
72 virtual QList<QWidget*> getControls() const;
73
76 virtual void setDialogButtons(QDialogButtonBox* theButtons);
77
78protected:
81 virtual bool storeValueCustom();
82
84 virtual bool restoreValueCustom();
85
87 virtual void activateCustom();
88
89 virtual void showEvent(QShowEvent* theEvent);
90
91 virtual void hideEvent(QHideEvent* theEvent);
92
93private slots:
96 void onDoubleClick(const QModelIndex& theIndex);
97
101 void onCloseEditor(QWidget* theEditor, QAbstractItemDelegate::EndEditHint theHint);
102
104 void onAdd();
105
107 void onInsert();
108
110 void onRemove();
111
113 void onImport();
114
116 void onUp();
117
119 void onDown();
120
122 void sendWarning();
123
125 void onSelectionChanged();
126
127 // A slot for show preview button
128 void onShowPreview();
129
130private:
132 FeaturePtr createParameter() const;
133
135 QTreeWidgetItem* createNewItem(QTreeWidgetItem* theParent) const;
136
138 QTreeWidgetItem* selectedItem() const;
139
141 void selectItemScroll(QTreeWidgetItem* theItem);
142
144 void updateItem(QTreeWidgetItem* theItem, const QList<QStringList>& theFeaturesList);
145
146 void updateFeaturesPart();
147
148 void updateParametersPart();
149
151 bool isValid();
152
154 bool hasName(const QString& theName, int theIndex) const;
155
157 void enableButtons(bool theEnable);
158
159 QList<QStringList> featuresItems(const QList<FeaturePtr>& theFeatures,
160 QList<FeaturePtr>& theFeatureList) const;
161 QList<QStringList> parametersItems(const QList<FeaturePtr>& theFeatures) const;
162
163 void updateParametersFeatures();
164
165 ModuleBase_IWorkshop* myWorkshop;
166
168 QTreeWidgetItem* myFeatures;
169 QTreeWidgetItem* myParameters;
171
172 QList<FeaturePtr> myParametersList;
173
174 QString myMessage;
175
176 QPushButton* myAddBtn;
177 QPushButton* myInsertBtn;
178 QPushButton* myRemoveBtn;
179 QPushButton* myImportBtn;
180 QToolButton* myUpBtn;
181 QToolButton* myDownBtn;
182
183 bool isUpplyBlocked;
184};
185
186
187#endif
Provides low-level API for WidgetFactory for reading xml definitions of widgets.
Definition: Config_WidgetAPI.h:46
Class which provides access to Workshop object services.
Definition: ModuleBase_IWorkshop.h:48
Widget for dialog.
Definition: ModuleBase_ModelDialogWidget.h:32
Definition: ParametersPlugin_WidgetParamsMgr.cpp:79
Definition: ParametersPlugin_WidgetParamsMgr.h:39
ParametersPlugin_TreeWidget(QWidget *theParent=0)
Constructor.
Definition: ParametersPlugin_WidgetParamsMgr.h:44
virtual void closeEditor(QWidget *theEditor, QAbstractItemDelegate::EndEditHint theHint)
Redefinition of virtual method.
Definition: ParametersPlugin_WidgetParamsMgr.cpp:152
Definition: ParametersPlugin_WidgetParamsMgr.h:60
virtual bool restoreValueCustom()
Restore value from attribute data to the widget's control.
Definition: ParametersPlugin_WidgetParamsMgr.cpp:333
virtual void setDialogButtons(QDialogButtonBox *theButtons)
Set general buttons from dialog.
Definition: ParametersPlugin_WidgetParamsMgr.cpp:277
ParametersPlugin_WidgetParamsMgr(QWidget *theParent, const Config_WidgetAPI *theData, ModuleBase_IWorkshop *theWorkshop)
Constructs a model widget.
Definition: ParametersPlugin_WidgetParamsMgr.cpp:188
virtual bool storeValueCustom()
Saves the internal parameters to the given feature.
Definition: ParametersPlugin_WidgetParamsMgr.cpp:310
virtual void activateCustom()
The method called when widget is activated.
Definition: ParametersPlugin_WidgetParamsMgr.cpp:338
virtual QList< QWidget * > getControls() const
Returns list of widget controls.
Definition: ParametersPlugin_WidgetParamsMgr.cpp:291
virtual ~ParametersPlugin_WidgetParamsMgr()
Destructs the model widget.
Definition: ParametersPlugin_WidgetParamsMgr.h:68