24 #include <initializer_list> 29 #include "ginteractor.h" 31 class _Internal_QComboBox;
48 GChooser(
const std::initializer_list<string>& items, QWidget* parent =
nullptr);
53 GChooser(
const std::vector<string>& items, QWidget* parent =
nullptr);
63 virtual void addItem(
const string& item);
68 virtual void addItems(
const std::initializer_list<string>& items);
73 virtual void addItems(
const std::vector<string>& items);
90 virtual string
getItem(
int index)
const;
111 string
getType()
const override;
137 virtual void setItem(
int index,
const string& item);
154 virtual int size()
const;
160 string getActionEventType()
const override;
165 _Internal_QComboBox* _iqcomboBox;
167 void checkIndex(
const string& member,
int index,
int min = 0,
int max = -1)
const;
169 friend class _Internal_QComboBox;
176 class _Internal_QComboBox :
public QComboBox,
public _Internal_QWidget {
180 _Internal_QComboBox(
GChooser* gchooser, QWidget* parent =
nullptr);
181 void detach()
override;
182 void keyPressEvent(QKeyEvent* event)
override;
183 void keyReleaseEvent(QKeyEvent* event)
override;
184 QSize sizeHint()
const override;
198 #endif // _gchooser_h virtual bool isEmpty() const
Returns true if the chooser has no items.
Definition: gchooser.cpp:137
virtual void setItem(int index, string item)
Sets the item at the given index in the chooser to the given value.
Definition: gchooser.cpp:141
~GChooser() override
Frees memory allocated internally by the chooser.
Definition: gchooser.cpp:46
string getActionCommand() const override
Returns an action command for this interactor, which is a semi-unique string you can use to identify ...
Definition: gchooser.cpp:92
virtual string getItem(int index) const
Returns the item in the chooser at the given 0-based index.
Definition: gchooser.cpp:108
QWidget* getWidget() const override
Returns a direct pointer to the internal Qt widget being wrapped by this interactor.
Definition: gchooser.cpp:129
This interactor subclass represents a selectable drop-down list.
Definition: gchooser.h:38
This abstract class is the superclass for all graphical interactors.
Definition: ginteractor.h:48
virtual void clearItems()
Removes all items from the chooser.
Definition: gchooser.cpp:86
_Internal_QWidget* getInternalWidget() const override
Returns a direct pointer to the internal Qt widget being wrapped by this interactor.
Definition: gchooser.cpp:104
virtual bool isEditable() const
Returns true if the chooser has an editable area for typing new items.
Definition: gchooser.cpp:133
virtual string getSelectedItem() const
Returns the currently selected item in the chooser, or an empty string if no item is currently select...
Definition: gchooser.cpp:121
GChooser(QWidget* parent=nullptr)
Creates a chooser that initially contains no items.
Definition: gchooser.cpp:23
virtual void setSelectedItem(string item)
Sets the given item in the chooser to be selected.
Definition: gchooser.cpp:161
virtual void addItems(const std::initializer_list< string > &items)
Adds each item from the given list to the end of the chooser's list.
Definition: gchooser.cpp:59
virtual int size() const
Returns the number of items in the chooser.
Definition: gchooser.cpp:171
virtual int getItemCount() const
Returns the number of items in the chooser.
Definition: gchooser.cpp:113
virtual void addItem(string item)
Adds a new item consisting of the specified string to the end of the list.
Definition: gchooser.cpp:52
virtual void setEditable(bool editable)
Sets whether the chooser has an editable area for typing new items.
Definition: gchooser.cpp:155
string getType() const override
Returns a string representing the class name of this interactor, such as "GButton" or "GCheckBox"...
Definition: gchooser.cpp:125
virtual void setSelectedIndex(int index)
Sets the item at the given index in the chooser to be selected.
Definition: gchooser.cpp:148
virtual int getSelectedIndex() const
Returns which index is selected in the chooser.
Definition: gchooser.cpp:117