QRadioButton Class Reference |
QRadioButton ( QWidget * parent = 0 ) | |
QRadioButton ( const QString & text, QWidget * parent = 0 ) |
virtual QSize | sizeHint () const |
void | initStyleOption ( QStyleOptionButton * option ) const |
virtual bool | event ( QEvent * e ) |
virtual bool | hitButton ( const QPoint & pos ) const |
virtual void | mouseMoveEvent ( QMouseEvent * e ) |
virtual void | paintEvent ( QPaintEvent * ) |
The QRadioButton widget provides a radio button with a text label.
A QRadioButton is an option button that can be switched on (checked) or off (unchecked). Radio buttons typically present the user with a "one of many" choice. In a group of radio buttons only one radio button at a time can be checked; if the user selects another button, the previously selected button is switched off.
Radio buttons are autoExclusive by default. If auto-exclusive is enabled, radio buttons that belong to the same parent widget behave as if they were part of the same exclusive button group. If you need multiple exclusive button groups for radio buttons that belong to the same parent widget, put them into a QButtonGroup.
Whenever a button is switched on or off it emits the toggled() signal. Connect to this signal if you want to trigger an action each time the button changes state. Use isChecked() to see if a particular button is selected.
Just like QPushButton, a radio button displays text, and optionally a small icon. The icon is set with setIcon(). The text can be set in the constructor or with setText(). A shortcut key can be specified by preceding the preferred character with an ampersand in the text. For example:
QRadioButton *button = new QRadioButton("Search from the &cursor", this);
In this example the shortcut is Alt+c. See the QShortcut documentation for details (to display an actual ampersand, use '&&').
Important inherited members: text(), setText(), text(), setDown(), isDown(), autoRepeat(), group(), setAutoRepeat(), toggle(), pressed(), released(), clicked(), and toggled().
A radio button shown in the Plastique widget style. | |
A radio button shown in the Windows XP widget style. | |
A radio button shown in the Macintosh widget style. |
See also QPushButton, QToolButton, QCheckBox, GUI Design Handbook: Radio Button, and Group Box Example.
Constructs a radio button with the given parent, but with no text or pixmap.
The parent argument is passed on to the QAbstractButton constructor.
Constructs a radio button with the given parent and a text string.
The parent argument is passed on to the QAbstractButton constructor.
Reimplemented from QObject::event().
Reimplemented from QAbstractButton::hitButton().
Initialize option with the values from this QRadioButton. This method is useful for subclasses when they need a QStyleOptionButton, but don't want to fill in all the information themselves.
See also QStyleOption::initFrom().
Reimplemented from QWidget::mouseMoveEvent().
Reimplemented from QWidget::paintEvent().
Reimplemented from QWidget::sizeHint().
Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. | Qt 4.6 | |
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD. | ||
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP ! |
Copyright © 2000-2012 - www.developpez.com