aboutsummaryrefslogtreecommitdiff
path: root/tests/client/loadmodel.qml
diff options
context:
space:
mode:
authorRenato Araujo Oliveira Filho <renato.filho@canonical.com>2012-10-16 14:30:47 -0300
committerRenato Araujo Oliveira Filho <renato.filho@canonical.com>2012-10-16 14:30:47 -0300
commitcc79785d02cadd4066c967e7b373d6ac2bb39b1c (patch)
tree76870946c0f111959410407288be78ee4889fac5 /tests/client/loadmodel.qml
parenta98d5486c37d68e1c1ce8fc1b6ad0a9018dd534d (diff)
parentced307a448aeed3a20d1a1e4bdcbf4dcbe4b1e46 (diff)
downloadqmenumodel-cc79785d02cadd4066c967e7b373d6ac2bb39b1c.tar.gz
qmenumodel-cc79785d02cadd4066c967e7b373d6ac2bb39b1c.tar.bz2
qmenumodel-cc79785d02cadd4066c967e7b373d6ac2bb39b1c.zip
Merged mainline.
Diffstat (limited to 'tests/client/loadmodel.qml')
-rw-r--r--tests/client/loadmodel.qml33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/client/loadmodel.qml b/tests/client/loadmodel.qml
new file mode 100644
index 0000000..7a1f045
--- /dev/null
+++ b/tests/client/loadmodel.qml
@@ -0,0 +1,33 @@
+import QtQuick 2.0
+import QMenuModel 0.1
+
+Item {
+ id: root
+ width: 100
+ height: 100
+
+ property bool reset: resetModel
+
+ onResetChanged: {
+ if (reset) {
+ // destroy the current model and check if it will not crash the QML engine
+ view.model.destroy();
+ }
+ }
+
+ ListView {
+ id: view
+ anchors.fill: parent
+ delegate: Text {
+ text: label
+ }
+ }
+
+ Component.onCompleted: {
+ // dynamically create the model to destroy it later
+ var model = Qt.createQmlObject("import QMenuModel 0.1; QDBusMenuModel { id: menuModel; busType: globalBusType; busName: globalBusName; objectPath: globalObjectPath; }", view, "");
+ model.start();
+ view.model = model;
+ }
+}
+