Debian Codegraph @

tests/test_errors/test_errors.qml

raw
1 import QtQuick 2.0
2 import io.thp.pyotherside 1.0
3
4 Rectangle {
5 id: page
6 width: 300
7 height: 300
8
9 Component.onCompleted: {
10 py.addImportPath(Qt.resolvedUrl('.').substr('file://'.length));
11 py.setHandler("test-errors", page.testErrors);
12 py.importModule("test_errors", null);
13 }
14
15 Python {
16 id: py
17
18 onError: {
19 console.log("PYTHON ERROR: " + traceback);
20 msg.text += '\n' + traceback;
21 }
22 }
23
24 Text {
25 id: msg
26 anchors {
27 top: parent.top
28 left: parent.left
29 right: parent.right
30 }
31 text: "Testing (you should see errors appearing here)..."
32 wrapMode: Text.Wrap
33 }
34
35 function testErrors() {
36 console.log("starting");
37 page.nonexistentMethod();
38 console.log("finished");
39 }
40 }