ICF 3.0.5.47
Technical documentation of ICF Libraries
CSelectionParamGuiComp.h
Go to the documentation of this file.
1/********************************************************************************
2** This file is part of the ICF Framework. Copyright (C) Witold Gantzke & Kirill Lepskiy
3** ICF Framework may be used under the terms of the LGPL License v. 2.1 by the Free Software Foundation.
4********************************************************************************/
5
6#ifndef iqtprm_CSelectionParamGuiComp_included
7#define iqtprm_CSelectionParamGuiComp_included
8
9
10// Qt includes
11#include <QtCore/QtGlobal>
12#include <QtGui/QStandardItemModel>
13#include <QtCore/QSortFilterProxyModel>
14#include <QtWidgets/QLineEdit>
15#include <QtWidgets/QComboBox>
16#include <QtWidgets/QRadioButton>
17#include <QtWidgets/QPushButton>
18#include <QtWidgets/QCompleter>
19#include <QtWidgets/QButtonGroup>
20
21
22// ICF includes
23#include <istd/TPointerVector.h>
24
29#include <GeneratedFiles/iprmgui/ui_CSelectionParamGuiComp.h>
30
31
32namespace iprmgui
33{
34
40 Ui::CSelectionParamGuiComp, iprm::ISelectionParam>,
42{
43 Q_OBJECT
44
45public:
47 Ui::CSelectionParamGuiComp, iprm::ISelectionParam> BaseClass;
48
69
74 {
79
83 LP_TOP
84 };
85
92
93 I_BEGIN_COMPONENT(CSelectionParamGuiComp);
94 I_ASSIGN(m_optionsLabelAttrPtr, "OptionsLabel", "Command label for the options selector", false, "Select");
95 I_ASSIGN(m_infoLabelAttrPtr, "InfoLabel", "Information label for the options selector", false, "Info");
96 I_ASSIGN(m_infoIconProviderCompPtr, "InfoIconProvider", "Provider of the info icon", false, "InfoIconProvider");
97 I_ASSIGN(m_iconSizeAttrPtr, "IconSize", "Size of the used icons", false, 32);
98 I_ASSIGN(m_uiModeAttrPtr, "UiMode", "Selection representation mode.\n0 - Combo box\n1 - Horizontally layouted radio button group\n2 - Vertically layouted radio button group", true, UM_COMBOBOX);
99 I_ASSIGN(m_labelPositionAttrPtr, "LabelPosition", "Selection label position.\n0 - Left from the selector,\n1 - On top of the selector", false, LP_LEFT);
100 I_ASSIGN(m_labelAlignAttrPtr, "LabelAlignment", "Selection label alignment.\n0 - Left-Top,\n1 - Center-Top,\n2 - Right-Top,\n3 - Left-Center,\n4 - Center,\n5 - Right-Center,\n6 - Left-Bottom,\n7 - Center-Bottom,\n8 - Right-Bottom", false, LA_LEFT_CENTER);
101 I_ASSIGN(m_labelWidthAttrPtr, "LabelWidth", "Fixed label width (in pixels)", false, 100);
102 I_ASSIGN(m_disableWhenEmptyAttrPtr, "DisableWhenEmpty", "Disable the control when no Option is available", true, false);
103 I_ASSIGN(m_noSelectionAllowedAttrPtr, "NoSelectionAllowed", "Allow the control to reset current index (i.e. set to -1)", true, false);
104 I_ASSIGN(m_fillWithDisabledOptionsEnabledAttrPtr, "FillWithDisabledOptionsEnabled", "Fill combo box also with disabled options, if enabled", true, false);
105 I_ASSIGN(m_useCompleterAttrPtr, "UseCompleter", "Enable completer for combo box", true, false);
106 I_END_COMPONENT;
107
109
110protected:
111 // reimplemented (istdgui::TGuiObserverWrap)
112 void OnGuiModelAttached() override;
113 void OnGuiModelDetached() override;
114 void UpdateGui(const istd::IChangeable::ChangeSet& changeSet) override;
115
116 // reimplemented (istdgui::CGuiComponentBase)
117 void OnGuiCreated() override;
118 void OnGuiDestroyed() override;
119 void OnGuiShown() override;
120 void OnGuiRetranslate() override;
121
122 // reimplemented (imod::CMultiModelDispatcherBase)
123 void OnModelChanged(int modelId, const istd::IChangeable::ChangeSet& changeSet) override;
124
125protected Q_SLOTS:
126 void OnSelectionChanged(int index);
127 void OnRadioButtonSelectionChanged(bool isSelected);
129 void OnFilterTextEdited(const QString& text);
130
131private:
132 void UpdateComboBoxesView();
133 void UpdateRadioButtonView();
134 void UpdateDescriptionFrame();
135 void UpdateSelectorLabel();
136 void ResetWidgets();
137 iprm::ISelectionParam* GetActiveSubselection(const iprm::ISelectionParam* selectionPtr) const;
138 void SetupInfoLabelIcon(QLabel& label);
139 QPixmap GetInfoIcon() const;
140 void UpdateCompletionModel();
141 void OnChanged(const istd::IChangeable::ChangeSet& changeSet);
142
143private:
144 I_TEXTATTR(m_optionsLabelAttrPtr);
145 I_TEXTATTR(m_infoLabelAttrPtr);
146 I_ATTR(int, m_uiModeAttrPtr);
147 I_ATTR(int, m_labelPositionAttrPtr);
148 I_ATTR(int, m_labelAlignAttrPtr);
149 I_ATTR(int, m_labelWidthAttrPtr);
150 I_REF(istdgui::IIconProvider, m_infoIconProviderCompPtr);
151 I_ATTR(int, m_iconSizeAttrPtr);
152 I_ATTR(bool, m_disableWhenEmptyAttrPtr);
153 I_ATTR(bool, m_noSelectionAllowedAttrPtr);
154 I_ATTR(bool, m_fillWithDisabledOptionsEnabledAttrPtr);
155 I_ATTR(bool, m_useCompleterAttrPtr);
156
157 class RadioButtonWidget: public QFrame
158 {
159 public:
160 typedef QFrame BaseClass;
161
162 RadioButtonWidget(
163 const QPixmap& infoIcon,
164 const QString& optionName,
165 const QString& optionDescription,
166 QButtonGroup* buttonGroupPtr,
167 QWidget& parentFrame);
168
169 QRadioButton* GetRadioButton() const;
170
171 private:
172 QRadioButton* m_radioButtonPtr;
173 QButtonGroup* m_buttonGroupPtr;
174 };
175
176 std::unique_ptr<QLabel> m_selectorLabelPtr;
179 istd::TPointerVector<QButtonGroup> m_radioButtonGroups;
180 std::unique_ptr<QFrame> m_radioButtonFramePtr;
181 QPushButton* m_resetButtonWidgetPtr;
182
183 QStandardItemModel m_completionModel;
184};
185
186
187} // namespace iprmgui
188
189
190#endif // !iqtprm_CSelectionParamGuiComp_included
191
192
Generic implementation of a data model changes notifier.
Interface allowing to select single option from list of options.
Simple editor for an exclusive option selection.
void OnFilterTextEdited(const QString &text)
void OnModelChanged(int modelId, const istd::IChangeable::ChangeSet &changeSet) override
Called when some model observed by dispatcher will be changed.
istdgui::TDesignerGuiObserverCompBase< Ui::CSelectionParamGuiComp, iprm::ISelectionParam > BaseClass
UiMode
GUI mode for selection representation.
@ UM_RADIOBUTTON_HORIZONTAL
Horizontal radio buttons group.
@ UM_RADIOBUTTON_VERTICAL
Vertical radio buttons group.
void OnGuiShown() override
Called from widget event filter when slave widget is shown.
void OnRadioButtonSelectionChanged(bool isSelected)
void OnGuiDestroyed() override
Called just before GUI is released.
void OnGuiModelDetached() override
void OnGuiCreated() override
Called just after GUI is initialized.
void UpdateGui(const istd::IChangeable::ChangeSet &changeSet) override
void OnSelectionChanged(int index)
void OnGuiRetranslate() override
Called from widget event filter when GUI should be retranslated.
void OnGuiModelAttached() override
Set of change flags (its IDs).
Definition IChangeable.h:38
Implementation of a pointer container, which controls the live cycle of the pointer object.
This interface provides acces to an icon.
Base class for all Qt GUI components.
#define I_TEXTATTR(member)
Declare translatable text attribute member.
This package contains Qt based implementations of standard parameter components.

© Witold Gantzke and Kirill Lepskiy