29 #include "ginteractor.h" 31 class _Internal_QCheckBox;
45 GCheckBox(
const string& text =
"",
bool checked =
false, QWidget* parent =
nullptr);
64 string
getType()
const override;
96 virtual void setText(
const string& text);
108 string getActionEventType()
const override;
113 _Internal_QCheckBox* _iqcheckBox;
115 friend class _Internal_QCheckBox;
122 class _Internal_QCheckBox :
public QCheckBox,
public _Internal_QWidget {
126 _Internal_QCheckBox(
GCheckBox* gcheckBox,
bool checked =
false, QWidget* parent =
nullptr);
127 void detach()
override;
128 void keyPressEvent(QKeyEvent* event)
override;
129 void keyReleaseEvent(QKeyEvent* event)
override;
130 QSize sizeHint()
const override;
133 void doubleClicked();
136 void handleStateChange(
int);
139 void mouseDoubleClickEvent(QMouseEvent* e)
override;
147 #endif // _gcheckbox_h GCheckBox(string text="", bool checked=false, QWidget* parent=nullptr)
Creates a checkbox with the given text.
Definition: gcheckbox.cpp:25
virtual void setChecked(bool checked)
Sets whether the checkbox should be checked.
Definition: gcheckbox.cpp:75
virtual string getText() const
Returns the text next to the checkbox.
Definition: gcheckbox.cpp:55
virtual void toggle()
Reverses the checked state of the box, setting it to be checked if it was unchecked or to be unchecke...
Definition: gcheckbox.cpp:91
string getActionCommand() const override
Returns an action command for this interactor, which is a semi-unique string you can use to identify ...
Definition: gcheckbox.cpp:39
virtual void setText(string text)
Sets the text that will appear next to the checkbox.
Definition: gcheckbox.cpp:85
_Internal_QWidget* getInternalWidget() const override
Returns a direct pointer to the internal Qt widget being wrapped by this interactor.
Definition: gcheckbox.cpp:51
~GCheckBox() override
Frees memory allocated internally by the checkbox.
Definition: gcheckbox.cpp:33
string getType() const override
Returns a string representing the class name of this interactor, such as "GButton" or "GCheckBox"...
Definition: gcheckbox.cpp:59
virtual bool isSelected() const
Returns true if the checkbox is currently checked.
Definition: gcheckbox.cpp:71
QWidget* getWidget() const override
Returns a direct pointer to the internal Qt widget being wrapped by this interactor.
Definition: gcheckbox.cpp:63
This abstract class is the superclass for all graphical interactors.
Definition: ginteractor.h:48
This interactor subclass represents an onscreen check box.
Definition: gcheckbox.h:39
virtual void setSelected(bool selected)
Sets whether the checkbox should be checked.
Definition: gcheckbox.cpp:81
virtual bool isChecked() const
Returns true if the checkbox is currently checked.
Definition: gcheckbox.cpp:67