Qt logo

QRadioButton Class Reference


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

#include <qradiobutton.h>

Inherits QButton.

List of all member functions.

Public Members

Protected Members


Detailed Description

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

QRadioButton and QCheckBox are both toggle buttons, that is, they can be switched on (checked) or off (unchecked). Unlike check boxes, radio buttons are normally organized in groups where only one radio button can be switched on at a time.

The QButtonGroup widget is very useful for defining groups of radio buttons.

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

Examples: xform/xform.cpp drawdemo/drawdemo.cpp


Member Function Documentation

QRadioButton::QRadioButton(QWidget*parent, constchar*name=0)

Constructs a radio button with no text.

The parent and name arguments are sent to the QWidget constructor.

QRadioButton::QRadioButton(constQString&text, QWidget*parent, constchar*name=0)

Constructs a radio button with a text.

The parent and name arguments are sent to the QWidget constructor.

voidQRadioButton::drawButton(QPainter*paint) [virtualprotected]

Draws the radio button, but not the button label.

See also: drawButtonLabel().

Reimplemented from QButton.

voidQRadioButton::drawButtonLabel(QPainter*p) [virtualprotected]

Draws the radio button label.

See also: drawButton().

Reimplemented from QButton.

voidQRadioButton::focusInEvent(QFocusEvent*e) [virtualprotected]

Reimplemented for internal reasons; the API is not affected.

Reimplemented from QWidget.

boolQRadioButton::hitButton(constQPoint&pos)const [virtualprotected]

Reimplements QButton::hitButton(). This function is implemented to prevent a radio button that is on from being switched off.

Reimplemented from QButton.

boolQRadioButton::isChecked()const

Returns TRUE if the radio button is checked, or FALSE if it is not checked.

See also: setChecked().

voidQRadioButton::setChecked(boolcheck) [virtual]

Checks the radio button if check is TRUE, or unchecks it if check is FALSE.

Calling this function does not affect other radio buttons unless a radio button group has been defined using the QButtonGroup widget.

See also: isChecked().

Examples: xform/xform.cpp drawdemo/drawdemo.cpp

QSizeQRadioButton::sizeHint()const [virtual]

Returns a size which fits the contents of the radio button.

Reimplemented from QWidget.

QSizePolicyQRadioButton::sizePolicy()const [virtual]

Specifies that this widget may stretch horizontally, but is fixed vertically.

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-99 Troll Tech, all rights reserved.


Copyright 1999 Troll TechTrademarks
Qt version 2.0.2