39
39
* The widget may be set as read-only. This has the same effect as disabling it, except
40
40
* that its appearance is unchanged.
42
* @author David Jarvie <software@astrojar.org.uk>
42
* @author David Jarvie <djarvie@kde.org>
44
44
class CheckBox : public QCheckBox
49
* @param parent The parent object of this widget.
51
explicit CheckBox(QWidget* parent);
53
* @param text Text to display.
54
* @param parent The parent object of this widget.
56
CheckBox(const QString& text, QWidget* parent);
57
/** Returns true if the widget is read only. */
58
bool isReadOnly() const { return mReadOnly; }
59
/** Sets whether the check box is read-only for the user. If read-only,
60
* its state cannot be changed by the user.
61
* @param readOnly True to set the widget read-only, false to set it read-write.
63
virtual void setReadOnly(bool readOnly);
64
/** Returns the widget which receives focus when the user selects the check box by clicking on it. */
65
QWidget* focusWidget() const { return mFocusWidget; }
66
/** Specifies a widget to receive focus when the user selects the check box by clicking on it.
67
* @param widget Widget to receive focus.
68
* @param enable If true, @p widget will be enabled before receiving focus. If
69
* false, the enabled state of @p widget will be left unchanged when
70
* the check box is clicked.
72
void setFocusWidget(QWidget* widget, bool enable = true);
74
virtual void mousePressEvent(QMouseEvent*);
75
virtual void mouseReleaseEvent(QMouseEvent*);
76
virtual void mouseMoveEvent(QMouseEvent*);
77
virtual void keyPressEvent(QKeyEvent*);
78
virtual void keyReleaseEvent(QKeyEvent*);
82
Qt::FocusPolicy mFocusPolicy; // default focus policy for the QCheckBox
83
QWidget* mFocusWidget; // widget to receive focus when button is clicked on
84
bool mFocusWidgetEnable; // enable focus widget before setting focus
85
bool mReadOnly; // value cannot be changed
49
* @param parent The parent object of this widget.
51
explicit CheckBox(QWidget* parent);
53
* @param text Text to display.
54
* @param parent The parent object of this widget.
56
CheckBox(const QString& text, QWidget* parent);
57
/** Returns true if the widget is read only. */
58
bool isReadOnly() const { return mReadOnly; }
59
/** Sets whether the check box is read-only for the user. If read-only,
60
* its state cannot be changed by the user.
61
* @param readOnly True to set the widget read-only, false to set it read-write.
63
virtual void setReadOnly(bool readOnly);
64
/** Returns the widget which receives focus when the user selects the check box by clicking on it. */
65
QWidget* focusWidget() const { return mFocusWidget; }
66
/** Specifies a widget to receive focus when the user selects the check box by clicking on it.
67
* @param widget Widget to receive focus.
68
* @param enable If true, @p widget will be enabled before receiving focus. If
69
* false, the enabled state of @p widget will be left unchanged when
70
* the check box is clicked.
72
void setFocusWidget(QWidget* widget, bool enable = true);
74
virtual void mousePressEvent(QMouseEvent*);
75
virtual void mouseReleaseEvent(QMouseEvent*);
76
virtual void mouseMoveEvent(QMouseEvent*);
77
virtual void keyPressEvent(QKeyEvent*);
78
virtual void keyReleaseEvent(QKeyEvent*);
82
Qt::FocusPolicy mFocusPolicy; // default focus policy for the QCheckBox
83
QWidget* mFocusWidget; // widget to receive focus when button is clicked on
84
bool mFocusWidgetEnable; // enable focus widget before setting focus
85
bool mReadOnly; // value cannot be changed
88
88
#endif // CHECKBOX_H