ACF $AcfVersion:0$
CSelectionParamGuiComp.h
Go to the documentation of this file.
1// SPDX-License-Identifier: LGPL-2.1-or-later OR GPL-2.0-or-later OR GPL-3.0-or-later OR LicenseRef-ACF-Commercial
2#pragma once
3
4
5// Qt includes
6#include <QtCore/QtGlobal>
7#include <QtGui/QStandardItemModel>
8#if QT_VERSION >= 0x050000
9#include <QtCore/QSortFilterProxyModel>
10#include <QtWidgets/QLineEdit>
11#include <QtWidgets/QComboBox>
12#include <QtWidgets/QRadioButton>
13#include <QtWidgets/QPushButton>
14#include <QtWidgets/QCompleter>
15#include <QtWidgets/QButtonGroup>
16#else
17#include <QtGui/QSortFilterProxyModel>
18#include <QtGui/QLineEdit>
19#include <QtGui/QComboBox>
20#include <QtGui/QRadioButton>
21#include <QtGui/QPushButton>
22#include <QtGui/QCompleter>
23#include <QtGui/QButtonGroup>
24#endif
25
26
27// ACF includes
28#include <istd/TPointerVector.h>
29
34#include <GeneratedFiles/iqtprm/ui_CSelectionParamGuiComp.h>
35
36
37namespace iqtprm
38{
39
45 Ui::CSelectionParamGuiComp, iprm::ISelectionParam>,
47{
48 Q_OBJECT
49
50public:
52 Ui::CSelectionParamGuiComp, iprm::ISelectionParam> BaseClass;
53
79
84 {
89
93 LP_TOP
94 };
95
102
103 I_BEGIN_COMPONENT(CSelectionParamGuiComp);
104 I_ASSIGN(m_optionsLabelAttrPtr, "OptionsLabel", "Command label for the options selector", false, "Select");
105 I_ASSIGN(m_infoLabelAttrPtr, "InfoLabel", "Information label for the options selector", false, "Info");
106 I_ASSIGN(m_infoIconProviderCompPtr, "InfoIconProvider", "Provider of the info icon", false, "InfoIconProvider");
107 I_ASSIGN(m_iconSizeAttrPtr, "IconSize", "Size of the used icons", false, 32);
108 I_ASSIGN(m_uiModeAttrPtr, "UiMode", "Selection representation mode.\n0 - Horizontally layouted combo box group\n1 - Horizontally layouted radio button group\n2 - Vertically layouted radio button group\n3 - Vertically layouted combo box group", true, UM_COMBOBOX);
109 I_ASSIGN(m_labelPositionAttrPtr, "LabelPosition", "Selection label position.\n0 - Left from the selector,\n1 - On top of the selector", false, LP_LEFT);
110 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);
111 I_ASSIGN(m_labelWidthAttrPtr, "LabelWidth", "Fixed label width (in pixels)", false, 100);
112 I_ASSIGN(m_disableWhenEmptyAttrPtr, "DisableWhenEmpty", "Disable the control when no Option is available", true, false);
113 I_ASSIGN(m_noSelectionAllowedAttrPtr, "NoSelectionAllowed", "Allow the control to reset current index (i.e. set to -1)", true, false);
114 I_ASSIGN(m_fillWithDisabledOptionsEnabledAttrPtr, "FillWithDisabledOptionsEnabled", "Fill combo box also with disabled options, if enabled", true, false);
115 I_ASSIGN(m_useCompleterAttrPtr, "UseCompleter", "Enable completer for combo box", true, false);
116 I_ASSIGN_MULTI_0(m_infoLabelListAttrPtr, "InfoLabelList", "Information label for the options selectors", false);
117 I_ASSIGN_MULTI_0(m_optionsLabelListAttrPtr, "OptionsLabelList", "Command label list for the options selectors", false);
118 I_END_COMPONENT;
119
121
122protected:
123 // reimplemented (iqtgui::TGuiObserverWrap)
124 virtual void OnGuiModelAttached() override;
125 virtual void OnGuiModelDetached() override;
126 virtual void UpdateGui(const istd::IChangeable::ChangeSet& changeSet) override;
127
128 // reimplemented (iqtgui::CGuiComponentBase)
129 virtual void OnGuiCreated() override;
130 virtual void OnGuiDestroyed() override;
131 virtual void OnGuiShown() override;
132 virtual void OnGuiRetranslate() override;
133
134 // reimplemented (imod::CMultiModelDispatcherBase)
135 virtual void OnModelChanged(int modelId, const istd::IChangeable::ChangeSet& changeSet) override;
136
137protected Q_SLOTS:
138 void OnSelectionChanged(int index);
139 void OnRadioButtonSelectionChanged(bool isSelected);
141 void OnFilterTextEdited(const QString& text);
142
143private:
144 void UpdateComboBoxesView();
145 void UpdateRadioButtonView();
146 void UpdateSelectorLabel();
147 void ResetWidgets();
148 iprm::ISelectionParam* GetActiveSubselection(const iprm::ISelectionParam* selectionPtr) const;
149 void SetupInfoLabelIcon(QLabel& label);
150 QPixmap GetInfoIcon() const;
151 void UpdateCompletionModel();
152
153private:
154 I_TEXTATTR(m_optionsLabelAttrPtr);
155 I_TEXTATTR(m_infoLabelAttrPtr);
156 I_ATTR(int, m_uiModeAttrPtr);
157 I_ATTR(int, m_labelPositionAttrPtr);
158 I_ATTR(int, m_labelAlignAttrPtr);
159 I_ATTR(int, m_labelWidthAttrPtr);
160 I_REF(iqtgui::IIconProvider, m_infoIconProviderCompPtr);
161 I_ATTR(int, m_iconSizeAttrPtr);
162 I_ATTR(bool, m_disableWhenEmptyAttrPtr);
163 I_ATTR(bool, m_noSelectionAllowedAttrPtr);
164 I_ATTR(bool, m_fillWithDisabledOptionsEnabledAttrPtr);
165 I_ATTR(bool, m_useCompleterAttrPtr);
166 I_MULTITEXTATTR(m_infoLabelListAttrPtr);
167 I_MULTITEXTATTR(m_optionsLabelListAttrPtr);
168
169 class RadioButtonWidget: public QFrame
170 {
171 public:
172 typedef QFrame BaseClass;
173
174 RadioButtonWidget(
175 const QPixmap& infoIcon,
176 const QString& optionName,
177 const QString& optionDescription,
178 QButtonGroup* buttonGroupPtr,
179 QWidget& parentFrame);
180
181 QRadioButton* GetRadioButton() const;
182
183 private:
184 QRadioButton* m_radioButtonPtr;
185 QButtonGroup* m_buttonGroupPtr;
186 };
187
188 istd::TDelPtr<QLabel> m_selectorLabelPtr;
191 istd::TPointerVector<QButtonGroup> m_radioButtonGroups;
192 istd::TDelPtr<QFrame> m_radioButtonFramePtr;
193 QList<QLabel*> m_descriptionLabelList;
194 QList<QLabel*> m_optionsLabelList;
195 QList<QLabel*> m_optionInfoLabelList;
196 QPushButton* m_resetButtonWidgetPtr;
197
198 QStandardItemModel m_completionModel;
199};
200
201
202} // namespace iqtprm
203
204
205
206
Generic implementation of a data model changes notifier.
Interface allowing to select single option from list of options.
This interface provides acces to an icon.
Base class for all Qt GUI components.
Simple editor for an exclusive option selection.
void OnFilterTextEdited(const QString &text)
virtual void OnModelChanged(int modelId, const istd::IChangeable::ChangeSet &changeSet) override
Called when some model observed by dispatcher will be changed.
void OnSelectionChanged(int index)
virtual void OnGuiModelAttached() override
virtual void OnGuiCreated() override
virtual void OnGuiShown() override
virtual void OnGuiModelDetached() override
virtual void UpdateGui(const istd::IChangeable::ChangeSet &changeSet) override
UiMode
GUI mode for selection representation.
@ UM_COMBOBOX
Horizontal combo box selection.
@ UM_COMBOBOX_VERTICAL
Vertical combo box selection.
@ UM_RADIOBUTTON_HORIZONTAL
Horizontal radio buttons group.
@ UM_RADIOBUTTON_VERTICAL
Vertical radio buttons group.
virtual void OnGuiDestroyed() override
void OnRadioButtonSelectionChanged(bool isSelected)
iqtgui::TDesignerGuiObserverCompBase< Ui::CSelectionParamGuiComp, iprm::ISelectionParam > BaseClass
virtual void OnGuiRetranslate() override
Set of change flags (its IDs).
Definition IChangeable.h:36
Pointer wrapper providing automatic deleting pointed object during destruction.
Definition TDelPtr.h:21
Implementation of a pointer container, which controls the live cycle of the pointer object.
#define I_MULTITEXTATTR(member)
Declare translatable multiple text attribute member.
#define I_TEXTATTR(member)
Declare translatable text attribute member.
This package contains Qt based implementations of standard parameter components.