diff options
author | Alan Alpert <alan.alpert@nokia.com> | 2010-04-19 11:42:49 (GMT) |
---|---|---|
committer | Alan Alpert <alan.alpert@nokia.com> | 2010-04-21 07:13:51 (GMT) |
commit | 202af3021362d3c8066bc479a95e7aad889bd928 (patch) | |
tree | 03587443c77403321c18e384b3277abd576e9ba3 /tests/auto/declarative/qdeclarativeqt/data | |
parent | 2ac290f56c6ad4f3e236034a7b99ecdb598ecc3a (diff) | |
download | Qt-202af3021362d3c8066bc479a95e7aad889bd928.zip Qt-202af3021362d3c8066bc479a95e7aad889bd928.tar.gz Qt-202af3021362d3c8066bc479a95e7aad889bd928.tar.bz2 |
Make the dynamic creation functions on the Qt object
Also updated examples to still work, and the dynamic example now uses
exceptions a little, to demonstrate that it can be done. Exceptions are
also now filled out with the QML error data.
Task-number: QT-2801
Reviewed-by: Aaron Kennedy
Diffstat (limited to 'tests/auto/declarative/qdeclarativeqt/data')
-rw-r--r-- | tests/auto/declarative/qdeclarativeqt/data/createComponent.qml | 10 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeqt/data/createQmlObject.qml | 18 |
2 files changed, 14 insertions, 14 deletions
diff --git a/tests/auto/declarative/qdeclarativeqt/data/createComponent.qml b/tests/auto/declarative/qdeclarativeqt/data/createComponent.qml index 412c467..253a4e3 100644 --- a/tests/auto/declarative/qdeclarativeqt/data/createComponent.qml +++ b/tests/auto/declarative/qdeclarativeqt/data/createComponent.qml @@ -6,15 +6,15 @@ QtObject { property string relativeUrl property string absoluteUrl - property QtObject incorectArgCount1: createComponent() - property QtObject incorectArgCount2: createComponent("main.qml", 10) + property QtObject incorectArgCount1: Qt.createComponent() + property QtObject incorectArgCount2: Qt.createComponent("main.qml", 10) Component.onCompleted: { - emptyArg = (createComponent("") == null); - var r = createComponent("createComponentData.qml"); + emptyArg = (Qt.createComponent("") == null); + var r = Qt.createComponent("createComponentData.qml"); relativeUrl = r.url; - var a = createComponent("http://www.example.com/test.qml"); + var a = Qt.createComponent("http://www.example.com/test.qml"); absoluteUrl = a.url; } } diff --git a/tests/auto/declarative/qdeclarativeqt/data/createQmlObject.qml b/tests/auto/declarative/qdeclarativeqt/data/createQmlObject.qml index 8e6c58e..9fe169d 100644 --- a/tests/auto/declarative/qdeclarativeqt/data/createQmlObject.qml +++ b/tests/auto/declarative/qdeclarativeqt/data/createQmlObject.qml @@ -4,11 +4,11 @@ Item { id: root // errors resulting in exceptions - property QtObject incorrectArgCount1: createQmlObject() - property QtObject incorrectArgCount2: createQmlObject("import Qt 4.6\nQtObject{}", root, "main.qml", 10) - property QtObject noParent: createQmlObject("import Qt 4.6\nQtObject{\nproperty int test: 13}", 0) - property QtObject notAvailable: createQmlObject("import Qt 4.6\nQtObject{Blah{}}", root) - property QtObject errors: createQmlObject("import Qt 4.6\nQtObject{\nproperty int test: 13\nproperty int test: 13\n}", root, "main.qml") + property QtObject incorrectArgCount1: Qt.createQmlObject() + property QtObject incorrectArgCount2: Qt.createQmlObject("import Qt 4.6\nQtObject{}", root, "main.qml", 10) + property QtObject noParent: Qt.createQmlObject("import Qt 4.6\nQtObject{\nproperty int test: 13}", 0) + property QtObject notAvailable: Qt.createQmlObject("import Qt 4.6\nQtObject{Blah{}}", root) + property QtObject errors: Qt.createQmlObject("import Qt 4.6\nQtObject{\nproperty int test: 13\nproperty int test: 13\n}", root, "main.qml") property bool emptyArg: false @@ -16,16 +16,16 @@ Item { Component.onCompleted: { // errors resulting in nulls - emptyArg = (createQmlObject("", root) == null); + emptyArg = (Qt.createQmlObject("", root) == null); try { - createQmlObject("import Qt 4.6\nQtObject{property int test\nonTestChanged: QtObject{}\n}", root) + Qt.createQmlObject("import Qt 4.6\nQtObject{property int test\nonTestChanged: QtObject{}\n}", root) } catch (error) { console.log("RunTimeError: ",error.message); } - var o = createQmlObject("import Qt 4.6\nQtObject{\nproperty int test: 13\n}", root); + var o = Qt.createQmlObject("import Qt 4.6\nQtObject{\nproperty int test: 13\n}", root); success = (o.test == 13); - createQmlObject("import Qt 4.6\nItem {}\n", root); + Qt.createQmlObject("import Qt 4.6\nItem {}\n", root); } } |