CExtParamsManagerGuiComp.h
Go to the documentation of this file.
1 #pragma once
2 
3 
4 // Qt includes
5 #include <QtCore/QtGlobal>
6 
7 #if QT_VERSION >= 0x050000
8 #include <QtWidgets/QMenu>
9 #include <QtWidgets/QStyledItemDelegate>
10 #include <QtWidgets/QDialog>
11 #else
12 #include <QtGui/QMenu>
13 #include <QtGui/QStyledItemDelegate>
14 #include <QtGui/QPainter>
15 #include <QtGui/QDialog>
16 #endif
17 
18 // ACF includes
19 #include <iqtgui/IIconProvider.h>
20 #include <iprm/IParamsManager.h>
22 #include <GeneratedFiles/iqtprm/ui_CExtParamsManagerGuiComp.h>
23 #include <GeneratedFiles/iqtprm/ui_CElementEditorGui.h>
24 
25 
26 namespace iqtprm
27 {
28 
29 
37  Ui::CExtParamsManagerGuiComp, iprm::IParamsManager>
38 {
39  Q_OBJECT
40 public:
42  Ui::CExtParamsManagerGuiComp, iprm::IParamsManager> BaseClass;
43 
44  I_BEGIN_COMPONENT(CExtParamsManagerGuiComp);
45  I_ASSIGN_MULTI_0(m_parameterEditorIdsAttrPtr, "ParameterEditorIds", "List of parameter editors type IDs used for showing the job's parameter for the corresponding worker types", false);
46  I_ASSIGN_MULTI_0(m_parameterGuisCompPtr, "ParameterEditors", "List of parameter editors used for showing the job's parameter for the corresponding worker types", false);
47  I_ASSIGN_TO(m_parameterObserversCompPtr, m_parameterGuisCompPtr, true);
48  I_ASSIGN_TO(m_parameterEditorsCompPtr, m_parameterGuisCompPtr, true);
49  I_END_COMPONENT;
50 
51 protected:
52  int GetParameterTypeIndexById(const QByteArray& parameterTypeId) const;
53  void UpdateCommands();
54 
55  // reimplemented (iqtgui::TGuiObserverWrap)
56  virtual void UpdateGui(const istd::IChangeable::ChangeSet& changeSet);
57 
58  // reimplemented (iqtgui::CGuiComponentBase)
59  virtual void OnGuiCreated();
60 
61 protected Q_SLOTS:
62  void on_AddButton_clicked();
64  void on_EditButton_clicked();
67  void on_ElementList_doubleClicked(const QModelIndex &index);
69 
70 protected:
71 
75  enum DataRoles
76  {
80  DR_DESCRIPTION = Qt::UserRole + 1,
81 
86 
91 
96  };
97 
101  class CElementItemDelegate: public QStyledItemDelegate
102  {
103  public:
104  // reimplemented (QItemDelegate)
105  virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
106  virtual QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
107  };
108 
113  class CElementEditorDialog: public QDialog
114  {
115  public:
117  virtual ~CElementEditorDialog();
118 
122  int Execute(QString &name, QString &description, iqtgui::IGuiObject* paramsGuiPtr);
123 
124  private:
125  Ui::CElementEditorGui m_ui;
126 
127  iqtgui::IGuiObject* m_guiObjectPtr;
128  };
129 
134  {
136  :observerPtr(NULL),
137  editorPtr(NULL),
138  guiPtr(NULL)
139  {
140  }
144  };
145 
149  typedef QMap<QByteArray, ParameterEditor> ParameterEditorMap;
151 
155  I_MULTIATTR(QByteArray, m_parameterEditorIdsAttrPtr);
156 
160  I_MULTIREF(iqtgui::IGuiObject, m_parameterGuisCompPtr);
161  I_MULTIREF(imod::IObserver, m_parameterObserversCompPtr);
162  I_MULTIREF(imod::IModelEditor, m_parameterEditorsCompPtr);
163 
165 };
166 
167 
168 } // namespace iqtprm
169 
170 
171 
172 
int GetParameterTypeIndexById(const QByteArray &parameterTypeId) const
iqtgui::TDesignerGuiObserverCompBase< Ui::CExtParamsManagerGuiComp, iprm::IParamsManager > BaseClass
virtual void OnGuiCreated()
Called just after GUI is initialized.
Manager of parameters set.
virtual void UpdateGui(const istd::IChangeable::ChangeSet &changeSet)
Do update of the GUI to reflect the state of model.
Delegate implementation for customization of the parameter set item view in the parameter set list...
Index of the parameter set in the list.
QMap< QByteArray, ParameterEditor > ParameterEditorMap
Mapping between the parameter type ID and corresponding editor.
virtual QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
Common interface for an model editor.
Definition: IModelEditor.h:19
Edit dialog for the parameter set name and description.
Internal structure used for binding of model editor, observer and gui editor for the parameter set in...
int Execute(QString &name, QString &description, iqtgui::IGuiObject *paramsGuiPtr)
Start the dialog with the predefined name and description parameters.
Base class for all Qt GUI components.
Common interface for GUI objects using in component context.
Definition: IGuiObject.h:25
DataRoles
Data roles used in the list view items.
#define NULL
Definition: istd.h:64
void on_ElementList_doubleClicked(const QModelIndex &index)
UI manager of the parameter sets.
Common interface for all classes implementing the Observer functionality in the Model/Observer design...
Definition: IObserver.h:24
Set of change flags (its IDs).
Definition: IChangeable.h:30
virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const

© 2007-2017 Witold Gantzke and Kirill Lepskiy