1
0
mirror of https://github.com/thp/pyotherside.git synced 2025-01-28 23:52:55 +08:00
pyotherside/tests/test_added_in_14/test_added_in_14.qml
Thomas Perl 5863efcfe9 Simplify API (remove callMethod again, merge into call)
callMethod(o, attr, ...) is just a special case of:
call(getattr(o, attr), ...)

Starting with import version 1.4, call() now accepts a
Python callable as alternative to the function name.
2014-10-08 15:13:54 +02:00

27 lines
714 B
QML

import QtQuick 2.0
// Note that we import 1.3 here instead of >= 1.4
import io.thp.pyotherside 1.3
Python {
Component.onCompleted: {
var foo = undefined;
// qml: Received error: Import PyOtherSide 1.4 or newer to use getattr()
getattr(foo, 'test');
var func = eval('[]');
// qml: Received error: Function not found: '' (unexpected EOF while parsing (<string>, line 0))
call(func, [], function (result) {});
// qml: Received error: Function not found: '' (unexpected EOF while parsing (<string>, line 0))
var result = call_sync(func, []);
Qt.quit();
}
onError: {
console.log('Received error: ' + traceback);
}
}