mirror of
https://github.com/thp/pyotherside.git
synced 2025-01-28 23:52:55 +08:00
5863efcfe9
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.
27 lines
714 B
QML
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);
|
|
}
|
|
}
|