aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/doc/snippets/code/src_qml_qqmllist.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/doc/snippets/code/src_qml_qqmllist.cpp')
-rw-r--r--src/qml/doc/snippets/code/src_qml_qqmllist.cpp47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/qml/doc/snippets/code/src_qml_qqmllist.cpp b/src/qml/doc/snippets/code/src_qml_qqmllist.cpp
new file mode 100644
index 0000000000..69c7fd9f22
--- /dev/null
+++ b/src/qml/doc/snippets/code/src_qml_qqmllist.cpp
@@ -0,0 +1,47 @@
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+namespace DocWrapper0 {
+//! [0]
+class FruitBasket : QObject {
+ Q_OBJECT
+ QML_LIST_PROPERTY_ASSIGN_BEHAVIOR_APPEND
+ Q_PROPERTY(QQmlListProperty<Fruit> fruit READ fruit)
+
+ public:
+ // ...
+ QQmlListProperty<Fruit> fruit();
+ // ...
+};
+//! [0]
+}
+
+namespace DocWrapper1 {
+//! [1]
+class FruitBasket : QObject {
+ Q_OBJECT
+ QML_LIST_PROPERTY_ASSIGN_BEHAVIOR_REPLACE_IF_NOT_DEFAULT
+ Q_PROPERTY(QQmlListProperty<Fruit> fruit READ fruit)
+
+ public:
+ // ...
+ QQmlListProperty<Fruit> fruit();
+ // ...
+};
+//! [1]
+}
+
+namespace DocWrapper2 {
+//! [2]
+class FruitBasket : QObject {
+ Q_OBJECT
+ QML_LIST_PROPERTY_ASSIGN_BEHAVIOR_REPLACE
+ Q_PROPERTY(QQmlListProperty<Fruit> fruit READ fruit)
+
+ public:
+ // ...
+ QQmlListProperty<Fruit> fruit();
+ // ...
+};
+//! [2]
+}