aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@theqtcompany.com>2015-06-09 22:27:41 +0200
committerJ-P Nurmi <jpnurmi@theqtcompany.com>2015-06-09 20:33:16 +0000
commit375cd1cadb5aaa50d76490f0fecb401620fb5677 (patch)
tree482ef7d422bd29d50cdc5a6d9a5bcaf301a58776 /src
parentc33d11c27924dd5b405b3de74f1644486767c073 (diff)
RadioButton docs
Change-Id: I158dac84c09172b7c27b227f673653feafb956af Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r--src/controls/doc/images/qtquickcontrols2-radiobutton-background.pngbin0 -> 2875 bytes
-rw-r--r--src/controls/doc/images/qtquickcontrols2-radiobutton-checked.pngbin0 -> 2292 bytes
-rw-r--r--src/controls/doc/images/qtquickcontrols2-radiobutton-disabled.pngbin0 -> 2366 bytes
-rw-r--r--src/controls/doc/images/qtquickcontrols2-radiobutton-focused.pngbin0 -> 2332 bytes
-rw-r--r--src/controls/doc/images/qtquickcontrols2-radiobutton-indicator.pngbin0 -> 2726 bytes
-rw-r--r--src/controls/doc/images/qtquickcontrols2-radiobutton-label.pngbin0 -> 2848 bytes
-rw-r--r--src/controls/doc/images/qtquickcontrols2-radiobutton-normal.pngbin0 -> 1883 bytes
-rw-r--r--src/controls/qquickradiobutton.cpp62
-rw-r--r--src/imports/controls/RadioButton.qml4
9 files changed, 65 insertions, 1 deletions
diff --git a/src/controls/doc/images/qtquickcontrols2-radiobutton-background.png b/src/controls/doc/images/qtquickcontrols2-radiobutton-background.png
new file mode 100644
index 00000000..3ee9590e
--- /dev/null
+++ b/src/controls/doc/images/qtquickcontrols2-radiobutton-background.png
Binary files differ
diff --git a/src/controls/doc/images/qtquickcontrols2-radiobutton-checked.png b/src/controls/doc/images/qtquickcontrols2-radiobutton-checked.png
new file mode 100644
index 00000000..9f71b6b6
--- /dev/null
+++ b/src/controls/doc/images/qtquickcontrols2-radiobutton-checked.png
Binary files differ
diff --git a/src/controls/doc/images/qtquickcontrols2-radiobutton-disabled.png b/src/controls/doc/images/qtquickcontrols2-radiobutton-disabled.png
new file mode 100644
index 00000000..f7fbcb7c
--- /dev/null
+++ b/src/controls/doc/images/qtquickcontrols2-radiobutton-disabled.png
Binary files differ
diff --git a/src/controls/doc/images/qtquickcontrols2-radiobutton-focused.png b/src/controls/doc/images/qtquickcontrols2-radiobutton-focused.png
new file mode 100644
index 00000000..dfb8d51e
--- /dev/null
+++ b/src/controls/doc/images/qtquickcontrols2-radiobutton-focused.png
Binary files differ
diff --git a/src/controls/doc/images/qtquickcontrols2-radiobutton-indicator.png b/src/controls/doc/images/qtquickcontrols2-radiobutton-indicator.png
new file mode 100644
index 00000000..f9e91709
--- /dev/null
+++ b/src/controls/doc/images/qtquickcontrols2-radiobutton-indicator.png
Binary files differ
diff --git a/src/controls/doc/images/qtquickcontrols2-radiobutton-label.png b/src/controls/doc/images/qtquickcontrols2-radiobutton-label.png
new file mode 100644
index 00000000..16c0ee08
--- /dev/null
+++ b/src/controls/doc/images/qtquickcontrols2-radiobutton-label.png
Binary files differ
diff --git a/src/controls/doc/images/qtquickcontrols2-radiobutton-normal.png b/src/controls/doc/images/qtquickcontrols2-radiobutton-normal.png
new file mode 100644
index 00000000..5a2d4bca
--- /dev/null
+++ b/src/controls/doc/images/qtquickcontrols2-radiobutton-normal.png
Binary files differ
diff --git a/src/controls/qquickradiobutton.cpp b/src/controls/qquickradiobutton.cpp
index c42a0207..1dcc309c 100644
--- a/src/controls/qquickradiobutton.cpp
+++ b/src/controls/qquickradiobutton.cpp
@@ -46,7 +46,67 @@ QT_BEGIN_NAMESPACE
\ingroup buttons
\brief A radio button control.
- TODO
+ RadioButton presents an option button that can be toggled on (checked) or
+ off (unchecked). Radio buttons are typically used to select one option
+ from a set of options.
+
+ \table
+ \row \li \image qtquickcontrols2-radiobutton-normal.png
+ \li A radio button in its normal state.
+ \row \li \image qtquickcontrols2-radiobutton-checked.png
+ \li A radio button that is checked.
+ \row \li \image qtquickcontrols2-radiobutton-focused.png
+ \li A radio button that has active focus.
+ \row \li \image qtquickcontrols2-radiobutton-disabled.png
+ \li A radio button that is disabled.
+ \endtable
+
+ \code
+ ColumnLayout {
+ ExclusiveGroup { id: group }
+ RadioButton {
+ checked: true
+ text: qsTr("First")
+ Exclusive.group: group
+ }
+ RadioButton {
+ text: qsTr("Second")
+ Exclusive.group: group
+ }
+ RadioButton {
+ text: qsTr("Third")
+ Exclusive.group: group
+ }
+ }
+ \endcode
+
+ \section1 Structure
+
+ RadioButton consists of three parts, \l {Control::background}{background},
+ \l {Button::label}{label} and \l {Checkable::indicator}{indicator}. Their
+ implicit sizes are used to calculate the implicit size of the control.
+
+ \section3 Background
+
+ \image qtquickcontrols2-radiobutton-background.png
+
+ RadioButton has no background item by default.
+
+ \section3 Label
+
+ \image qtquickcontrols2-radiobutton-label.png
+
+ The following snippet presents the default label item implementation.
+
+ \snippet RadioButton.qml label
+
+ \section3 Indicator
+
+ \image qtquickcontrols2-radiobutton-indicator.png
+
+ The following snippet presents the default indicator item implementation.
+
+ \snippet RadioButton.qml indicator
\sa ExclusiveGroup
*/
diff --git a/src/imports/controls/RadioButton.qml b/src/imports/controls/RadioButton.qml
index 31c198ac..106b382e 100644
--- a/src/imports/controls/RadioButton.qml
+++ b/src/imports/controls/RadioButton.qml
@@ -55,6 +55,7 @@ AbstractRadioButton {
padding: Theme.padding
+ //! [indicator]
indicator: Rectangle {
implicitWidth: 20
implicitHeight: 20
@@ -80,7 +81,9 @@ AbstractRadioButton {
border.color: control.Theme.frameColor
}
}
+ //! [indicator]
+ //! [label]
label: Text {
x: control.mirrored ? control.leftPadding : (indicator.x + indicator.width + control.Theme.spacing)
y: control.topPadding
@@ -94,4 +97,5 @@ AbstractRadioButton {
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
}
+ //! [label]
}