diff options
| author | Fabian Kosmale <fabian.kosmale@qt.io> | 2024-02-27 08:50:47 +0100 |
|---|---|---|
| committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2024-02-27 10:51:47 +0100 |
| commit | 6406dd28bc39d160f1c87869babc6ed31b04c4df (patch) | |
| tree | d73bd5989aed23800085995bc48f66d9428168b1 /src/quicktemplates/qquickstackview.cpp | |
| parent | 9c5fc883881799fa28cf74535351e76dcea10a0a (diff) | |
StackView: Fix and clarify pushItems documentation
The code snippet needs to use pushItems not push (which was a leftover
from before we renamed the function).
Moreover, clarify that items itself has to be an array, and mention the
possibility of passing arguments a bit earlier.
Pick-to: 6.7
Change-Id: I8c7cf3576c692b2b5f543a706ec61406c37906dc
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/quicktemplates/qquickstackview.cpp')
| -rw-r--r-- | src/quicktemplates/qquickstackview.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/quicktemplates/qquickstackview.cpp b/src/quicktemplates/qquickstackview.cpp index 457423104e..e97fecf1f6 100644 --- a/src/quicktemplates/qquickstackview.cpp +++ b/src/quicktemplates/qquickstackview.cpp @@ -934,8 +934,10 @@ void QQuickStackView::replace(QQmlV4Function *args) \since 6.7 Pushes \a items onto the stack using an optional \a operation, and - optionally applies a set of properties on each element. Each element can be - an \l Item, \l Component, or \l [QML] url. Returns the item that became + optionally applies a set of properties on each element. \a items is an array + of elements. Each element can be + an \l Item, \l Component, or \l [QML] url and can be followed by an optional + properties argument (see below). Returns the item that became current (the last item). StackView creates an instance automatically if the pushed element is a @@ -948,14 +950,14 @@ void QQuickStackView::replace(QQmlV4Function *args) stackView.push([item, rectComponent, Qt.resolvedUrl("MyItem.qml")]) // With properties: - stackView.push([ + stackView.pushItems([ item, { "color": "red" }, rectComponent, { "color": "green" }, Qt.resolvedUrl("MyItem.qml"), { "color": "blue" } ]) // With properties for only some items: - stackView.push([ + stackView.pushItems([ item, { "color": "yellow" }, rectComponent ]) |
