Debian Codegraph @

examples/qobject_reference.qml

raw
1 import QtQuick 2.0
2 import io.thp.pyotherside 1.4
3
4 Rectangle {
5 id: root
6 width: 400
7 height: 400
8
9 Rectangle {
10 id: foo
11 x: 123
12 y: 123
13 width: 20
14 height: 20
15 color: 'blue'
16
17 function dynamicFunction(a, b, c) {
18 console.log('In QML, dynamicFunction got: ' + a + ', ' + b + ', ' + c);
19 rotation += 4;
20 return 'hello';
21 }
22 }
23
24 Python {
25 id: py
26
27 Component.onCompleted: {
28 addImportPath(Qt.resolvedUrl('.'));
29 importModule('qobject_reference', function () {
30 call('qobject_reference.foo', [foo, py], function (result) {
31 console.log('In QML, got result: ' + result);
32 result.color = 'green';
33 });
34 });
35 }
36 }
37 }