The QCheckBox widget provides a check box with a text label. More...
#include <qcheckbox.h>
Inherits QButton.
Type | Name | READ | WRITE | Options |
---|---|---|---|---|
bool | checked | isChecked | setChecked | |
bool | tristate | isTristate | setTristate |
QCheckBox and QRadioButton are both option buttons. That is, they can be switched on (checked) or off (unchecked). The classes differ in how the choices for the user are restricted. Radio buttons define a "one of many" choice, while check-boxes provide "many of many" choices.
While it is technically possible to implement radio-behaviour with check boxes and vice versa, it's strongly recommended to stick with the well-known semantics. Otherwise your users would be pretty confused.
Use QButtonGroup to group check-buttons visually.
Whenver a check box is checked or cleared, it emits the signal toggled(). Connect to this signal if you want to trigger an action each time the box changes state. Otherwise, use isChecked() to query whether or not a particular check box is selected.
In addition to the usual checked and unchecked states, QCheckBox optionally provides a third state to indicate "no change". This is useful whenever you need to give the user the option of neither setting nor unsetting an option. If you need that third state, enable it with setTristate() and use state() to query the current toggle state. When a tristate box changes state, it emits the stateChanged() signal.
See also QButton, QRadioButton and Fowler: Check Box.
Examples: xform/xform.cpp i18n/main.cpp
Constructs a check box with no text.
The parent and name arguments are sent to the QWidget constructor.
Constructs a check box with a text.
The parent and name arguments are sent to the QWidget constructor.
[virtual protected]
Reimplemented for internal reasons; the API is not affected.
Reimplemented from QButton.
[virtual protected]
Reimplemented for internal reasons; the API is not affected.
Reimplemented from QButton.
Returns TRUE if the check box is checked, or FALSE if it is not checked.
See also setChecked().
Examples: xform/xform.cpp
Returns TRUE if the checkbox is a tristate checkbox. Otherwise returns FALSE.
See also setTristate().
[virtual protected]
Reimplemented for internal reasons; the API is not affected.
Reimplemented from QWidget.
Checks the check box if check is TRUE, or unchecks it if check is FALSE.
See also isChecked().
Sets the checkbox into the "no change" state.
See also setTristate().
Makes the check box a tristate check box if y is TRUE. A tristate check box provides an additional state NoChange.
Use tristate check boxes whenever you need to give the user the option of neither setting nor unsetting an option. A typical example is the "Italic" check box in the font dialog of a word processor when the marked text is partially Italic and partially not.
See also isTristate(), setNoChange(), stateChanged() and state().
[virtual]
Reimplemented for internal reasons; the API is not affected.
Reimplemented from QWidget.
[virtual]
Reimplemented for internal reasons; the API is not affected.
Reimplemented from QWidget.
[virtual protected]
Reimplemented for internal reasons; the API is not affected.
Reimplemented from QWidget.
Search the documentation, FAQ, qt-interest archive and more (uses
www.trolltech.com):
This file is part of the Qt toolkit, copyright © 1995-2000 Trolltech, all rights reserved.
Copyright İ 2000 Trolltech | Trademarks | Qt version 2.2.1
|