Qt Reference Documentation

QML RadioButton Element

Provides a radio button with a line of text that the user can choose. More...

This element was introduced in Qt Quick Components 1.0.


Signal Handlers

Detailed Description

A radio button component consists of a radio button and a line of text. Only one item in a list may be selected at a time. Once an item is selected, it can be deselected only by selecting another item. Initial item selection may be set at the list creation. If not set, the list is shown without a selection.

When a radio button has the focus, the radio button can be selected using the Qt.Key_Select, Qt.Key_Return, and Qt.Key_Enter hardware keys.

Using a Radio Button

The following code creates a row with three radio buttons in it. The platformExclusiveGroup property of all the radio buttons is 'group' that is a CheckableGroup. This enforces that only one of the radio buttons can be selected at a time. The radio button with the text '3' is checked.

First, notice the need to import also Qt.labs.components plugin due to the CheckableGroup:

 import com.nokia.symbian 1.1
 import Qt.labs.components 1.1

Then, implement the radio buttons:

 CheckableGroup { id: group }
 Row {
     id: row
     spacing: platformStyle.paddingMedium
     RadioButton {
         id: button1
         text: "1"
         platformExclusiveGroup: group
     RadioButton {
         id: button2
         text: "2"
         platformExclusiveGroup: group
     RadioButton {
         id: button3
         text: "3"
         platformExclusiveGroup: group
         checked: true

The screenshot below shows the result of the code snippet.

Property Documentation

checked : bool

If a button is checked, checked is true. Otherwise it is false.

See also Checkable.

platformExclusiveGroup : QtObject

The exclusive group that this radio button belongs to. In an exclusive group, only one of the radio buttons can be selected at a time.

See also CheckableGroup.

platformInverted : bool


If platformInverted is true, the component is visualized with the inverted style. For more information, see Using Inverted Style with Symbian Components. By default platformInverted is false.

This property group was introduced in Qt Quick Components 1.1.

pressed : bool

Indicates that the user is pressing this radio button.

See also clicked.

text : string

The text that is shown beside the radio button.

Signal Handler Documentation

RadioButton::clicked ()

This signal is emitted if the button is pressed and then released.