File: test_callparam.qml

package info (click to toggle)
pyotherside 1.6.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 880 kB
  • sloc: cpp: 2,869; python: 475; makefile: 152; sh: 35
file content (27 lines) | stat: -rw-r--r-- 694 bytes parent folder | download | duplicates (5)
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
import QtQuick 2.0
import io.thp.pyotherside 1.0

Rectangle {
    id: page
    width: 300
    height: 300

    Python {
        Component.onCompleted: {
            // We use call_sync() instead of call() in order
            // to guarantee the right ordering of Python's output
            // and the output of the JS engine for the error

            // This should fail with an error:
            // "Not a parameter list in call to print: 123"
            call_sync('print', 123);

            // This should work and print "123" on the console
            call_sync('print', [123]);
        }

        onError: {
            console.log('Received error: ' + traceback);
        }
    }
}