CButtonBasedSelectionParamGuiComp.h
Go to the documentation of this file.
1 #ifndef iqtprm_CButtonBasedSelectionParamGuiComp_included
2 #define iqtprm_CButtonBasedSelectionParamGuiComp_included
3 
4 
5 // Qt includes
6 #include <QtCore/QtGlobal>
7 #if QT_VERSION >= 0x050000
8 #include <QtWidgets/QCommandLinkButton>
9 #include <QtWidgets/QToolButton>
10 #include <QtWidgets/QRadioButton>
11 #include <QtWidgets/QButtonGroup>
12 #else
13 #include <QtGui/QCommandLinkButton>
14 #include <QtGui/QToolButton>
15 #include <QtGui/QRadioButton>
16 #endif
17 
18 // ACF includes
19 #include <iprm/ISelectionParam.h>
20 #include <iqtgui/IIconProvider.h>
22 
23 #include <GeneratedFiles/iqtprm/ui_CButtonBasedSelectionParamGuiComp.h>
24 
25 
26 namespace iqtprm
27 {
28 
34  Ui::CButtonBasedSelectionParamGuiComp, iprm::ISelectionParam>
35 {
36  Q_OBJECT
37 
38 public:
40  Ui::CButtonBasedSelectionParamGuiComp, iprm::ISelectionParam> BaseClass;
41 
42  I_BEGIN_COMPONENT(CButtonBasedSelectionParamGuiComp);
43  I_ASSIGN(m_iconProviderCompPtr, "IconProvider", "Provider of the button icons", false, "IconProvider");
44  I_ASSIGN(m_fontSizeAttrPtr, "FontSize", "Font Size", true, 8);
45  I_ASSIGN(m_iconSizeAttrPtr, "IconSize", "Icon Size", true, 16);
46  I_ASSIGN(m_minWidthAttrPtr, "MinimumWidth", "Minimum width of the buttons (0 - default)", true, 0);
47  I_ASSIGN(m_layoutTypeAttrPtr, "LayoutType", "0 - horizontal\n1 - vertical\n2 and more - number of columns", true, 1);
48  I_ASSIGN(m_descriptionTypeAttrPtr, "DescriptionType", "0 - No description visible\n1 - Default (description is alvays visible)\n2 - Compact (description is visible for checked button only)", true, 1);
49  I_ASSIGN(m_showTooltipAttrPtr, "DescriptionAsTooltip", "Show description as tooltip", true, false);
50  I_END_COMPONENT;
51 
52 protected:
53  // reimplemented (iqtgui::TGuiObserverWrap)
54  virtual void OnGuiModelAttached();
55  virtual void OnGuiModelDetached();
56  virtual void UpdateGui(const istd::IChangeable::ChangeSet& changeSet);
57 
58 protected Q_SLOTS:
59  void OnButtonClicked(int index);
60 
61 private:
62  struct SelectionInfo{
63  SelectionInfo* parentInfoPtr;
64  iprm::ISelectionParam* paramPtr;
65  int index;
66  };
67 
68  QList<SelectionInfo*> m_selectionInfos;
69  QList<SelectionInfo*> m_allSelectionInfos;
70 
71  void CreateButtons(const iprm::ISelectionParam* paramPtr, SelectionInfo* parentSelectionInfoPtr, int& totalButtons);
72  QAbstractButton* CreateButton(QWidget* parentPtr, const QString& description);
73  void DestroyButtons();
74 
75 private:
76  I_REF(iqtgui::IIconProvider, m_iconProviderCompPtr);
77  I_ATTR(int, m_fontSizeAttrPtr);
78  I_ATTR(int, m_iconSizeAttrPtr);
79  I_ATTR(int, m_minWidthAttrPtr);
80  I_ATTR(bool, m_showTooltipAttrPtr);
81  I_ATTR(int, m_layoutTypeAttrPtr);
82  I_ATTR(int, m_descriptionTypeAttrPtr);
83 
84  QButtonGroup m_buttonsGroup;
85 };
86 
87 
88 } // namespace iqtprm
89 
90 
91 #endif // !iqtprm_CButtonBasedSelectionParamGuiComp_included
92 
93 
This interface provides acces to an icon.
Definition: IIconProvider.h:21
iqtgui::TDesignerGuiObserverCompBase< Ui::CButtonBasedSelectionParamGuiComp, iprm::ISelectionParam > BaseClass
virtual void UpdateGui(const istd::IChangeable::ChangeSet &changeSet)
Do update of the GUI to reflect the state of model.
QCommandButton-based editor for an exclusive option selection.
Base class for all Qt GUI components.
virtual void OnGuiModelAttached()
Called when model is attached and GUI is created.
Set of change flags (its IDs).
Definition: IChangeable.h:30
Interface allowing to select single option from list of options.
virtual void OnGuiModelDetached()
Called when model is detached or GUI is destroyed.

© 2007-2017 Witold Gantzke and Kirill Lepskiy