Home · All Classes · Modules

QRadioButton Class Reference
[QtGui module]

The QRadioButton widget provides a radio button with a text label. More...

Inherits QAbstractButton.

Methods


Detailed Description

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 text can be set in the constructor or with setText(); the icon is set with setIcon().

Important inherited members: text(), setText(), text(), setDown(), isDown(), autoRepeat(), group(), setAutoRepeat(), toggle(), pressed(), released(), clicked(), and toggled().

Screenshot of a Plastique radio button A radio button shown in the Plastique widget style.
Screenshot of a Windows XP radio button A radio button shown in the Windows XP widget style.
Screenshot of a Macintosh radio button A radio button shown in the Macintosh widget style.


See also QPushButton, QToolButton, QCheckBox, and GUI Design Handbook: Radio Button.


Method Documentation

QRadioButton.__init__ (self, QWidget parent = None)

The parent argument, if not None, causes self to be owned by Qt instead of PyQt.

Constructs a radio button with the given parent, but with no text or pixmap.

The parent argument is passed on to the QAbstractButton constructor.

QRadioButton.__init__ (self, QString text, QWidget parent = None)

The parent argument, if not None, causes self to be owned by Qt instead of PyQt.

Constructs a radio button with the given parent and a text string.

The parent argument is passed on to the QAbstractButton constructor.

bool QRadioButton.event (self, QEvent e)

bool QRadioButton.hitButton (self, QPoint)

QRadioButton.mouseMoveEvent (self, QMouseEvent)

QRadioButton.paintEvent (self, QPaintEvent)

QSize QRadioButton.sizeHint (self)


PyQt 4.0.1 for X11Copyright © Riverbank Computing Ltd and Trolltech AS 2006Qt 4.1.4