blob: ca3ff22b0b053b8b7f6cbb029475c53da9c15d1f (
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.7
Item {
id: root
// errors resulting in exceptions
property QtObject incorrectArgCount1: Qt.createQmlObject()
property QtObject incorrectArgCount2: Qt.createQmlObject("import Qt 4.7\nQtObject{}", root, "main.qml", 10)
property QtObject noParent: Qt.createQmlObject("import Qt 4.7\nQtObject{\nproperty int test: 13}", 0)
property QtObject notAvailable: Qt.createQmlObject("import Qt 4.7\nQtObject{Blah{}}", root)
property QtObject errors: Qt.createQmlObject("import Qt 4.7\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.7\nQtObject{property int test\nonTestChanged: QtObject{}\n}", root)
} catch (error) {
console.log("RunTimeError: ",error.message);
}
var o = Qt.createQmlObject("import Qt 4.7\nQtObject{\nproperty int test: 13\n}", root);
success = (o.test == 13);
Qt.createQmlObject("import Qt 4.7\nItem {}\n", root);
}
}
|