The QRadioButton widget provides a radio button with a text label. More...
#include <qradiobutton.h>
Inherits QButton.
QRadioButton and QCheckBox 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. Check-boxes define "many of many" choices, while radio buttons provide a "one of many" choice. In a group of radio buttons, only one button at a time can be checked. If the user selects another button, the previously selected button is switched off.
While it is technically possible to imlement 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.
The easiest way to implement a "one of many" choice, is to simply stick the radio buttons into QButtonGroup.
Whenver a button is switched on or off, it emits the signal toggled(). Connect to this signal if you want to trigger an action each time the button changes state. Otherwise, use isChecked() to query whether or not a particular button is selected.
See also: QPushButton, QToolButton and GUI Design Handbook: Radio Button
Examples: xform/xform.cpp drawdemo/drawdemo.cpp
[virtual protected]
Draws the radio button, but not the button label.
See also: drawButtonLabel().
Reimplemented from QButton.
[virtual protected]
Draws the radio button label.
See also: drawButton().
Reimplemented from QButton.
[virtual protected]
Reimplemented for internal reasons; the API is not affected.
Reimplemented from QWidget.
[virtual protected]
Reimplements QButton::hitButton(). This function is implemented to prevent a radio button that is on from being switched off.
Reimplemented from QButton.
[virtual protected]
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.troll.no):
This file is part of the Qt toolkit, copyright © 1995-2000 Troll Tech, all rights reserved.
Copyright © 2000 Troll Tech | Trademarks | Qt version 2.1.0 (pre-release)
|