aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmlmodels/doc/snippets/delegatemodel/delegatemodel.qml
diff options
context:
space:
mode:
Diffstat (limited to 'src/qmlmodels/doc/snippets/delegatemodel/delegatemodel.qml')
-rw-r--r--src/qmlmodels/doc/snippets/delegatemodel/delegatemodel.qml28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/qmlmodels/doc/snippets/delegatemodel/delegatemodel.qml b/src/qmlmodels/doc/snippets/delegatemodel/delegatemodel.qml
new file mode 100644
index 0000000000..51bba64534
--- /dev/null
+++ b/src/qmlmodels/doc/snippets/delegatemodel/delegatemodel.qml
@@ -0,0 +1,28 @@
+// Copyright (C) 2017 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+//![0]
+import QtQuick
+import QtQml.Models
+
+Rectangle {
+ width: 200; height: 100
+
+ DelegateModel {
+ id: visualModel
+ model: ListModel {
+ ListElement { name: "Apple" }
+ ListElement { name: "Orange" }
+ }
+ delegate: Rectangle {
+ height: 25
+ width: 100
+ Text { text: "Name: " + name}
+ }
+ }
+
+ ListView {
+ anchors.fill: parent
+ model: visualModel
+ }
+}
+//![0]