diff options
Diffstat (limited to 'src/quicktemplates/qquickbuttongroup.cpp')
| -rw-r--r-- | src/quicktemplates/qquickbuttongroup.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/quicktemplates/qquickbuttongroup.cpp b/src/quicktemplates/qquickbuttongroup.cpp index d57b82c8e7..108a1a9ecb 100644 --- a/src/quicktemplates/qquickbuttongroup.cpp +++ b/src/quicktemplates/qquickbuttongroup.cpp @@ -84,6 +84,29 @@ QT_BEGIN_NAMESPACE } \endcode + Another option is to filter the list of children. This is especially handy + if you're using a repeater to populate it, since the repeater will also be + a child of the parent layout: + + \code + ButtonGroup { + buttons: column.children.filter((child) => child !== repeater) + } + + Column { + id: column + + Repeater { + id: repeater + model: [ qsTr("DAB"), qsTr("AM"), qsTr("FM") ] + RadioButton { + required property string modelData + text: modelData + } + } + } + \endcode + More advanced use cases can be handled using the \c addButton() and \c removeButton() methods. |
