blob: 9fe169d208187943397c3333f3a2b0214cab8854 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
import Qt 4.6
Item {
id: root
// errors resulting in exceptions
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
property bool success: false
Component.onCompleted: {
// errors resulting in nulls
emptyArg = (Qt.createQmlObject("", root) == null);
try {
Qt.createQmlObject("import Qt 4.6\nQtObject{property int test\nonTestChanged: QtObject{}\n}", root)
} catch (error) {
console.log("RunTimeError: ",error.message);
}
var o = Qt.createQmlObject("import Qt 4.6\nQtObject{\nproperty int test: 13\n}", root);
success = (o.test == 13);
Qt.createQmlObject("import Qt 4.6\nItem {}\n", root);
}
}
|