HomeHome

Classes - Annotated - Tree - Functions - Home - Structure Qte

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

Important Inherited Members

Properties

TypeNameREADWRITEOptions
boolcheckedisCheckedsetChecked 

Detailed Description

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

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 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.

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


Member Function Documentation

QRadioButton::QRadioButton ( QWidget * parent, const char * name=0 )

Constructs a radio button with no text.

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

QRadioButton::QRadioButton ( const QString & text, QWidget * parent, const char * name=0 )

Constructs a radio button with a text.

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

void QRadioButton::drawButton ( QPainter * paint ) [virtual protected]

Reimplemented for internal reasons; the API is not affected.

Reimplemented from QButton.

void QRadioButton::drawButtonLabel ( QPainter * p ) [virtual protected]

Reimplemented for internal reasons; the API is not affected.

Reimplemented from QButton.

void QRadioButton::focusInEvent ( QFocusEvent * e ) [virtual protected]

Reimplemented for internal reasons; the API is not affected.

Reimplemented from QWidget.

bool QRadioButton::hitButton ( const QPoint & pos ) const [virtual protected]

Reimplemented for internal reasons; the API is not affected.

Reimplemented from QButton.

bool QRadioButton::isChecked () const

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

See also setChecked().

void QRadioButton::resizeEvent ( QResizeEvent * e ) [virtual protected]

Reimplemented for internal reasons; the API is not affected.

Reimplemented from QWidget.

void QRadioButton::setChecked ( bool check ) [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

QSize QRadioButton::sizeHint () const [virtual]

Reimplemented for internal reasons; the API is not affected.

Reimplemented from QWidget.

QSizePolicy QRadioButton::sizePolicy () const [virtual]

Reimplemented for internal reasons; the API is not affected.

Reimplemented from QWidget.

void QRadioButton::updateMask () [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-2005 Trolltech, all rights reserved.


Copyright © 2005 TrolltechTrademarks
Qt version 2.3.10