-
User Story
-
Resolution: Unresolved
-
Not Evaluated
-
None
-
None
As a user of the QtQuickViewContent / QtQuickView API, some of the QML functions I define may need to return values when called. Right now, the function API introduced by QTBUG-137112 does not support this.
Possible implementation:
- qtbase androiddeployqt:
- Figure out a way to detect the QML type returned by a QML function via qmldom
- Generate the correct signature for QtQuickViewContent types
- Generate the method implementation in QtQuickViewContent-descendant type, that will call the QtQuickView implementation defined below.
- qtdeclarative:
- Provide a typed (Object only or Integer+Double+Float+...other types) API to QtQuickView.java to call functions that return values
- Provide support on the JNI interface for types - a single function that returns Object is sufficient, just convert from Object to necessary Type when returning the value to user
- e.g. native method: Object invokeMethod(args)
- usage:
- Integer callIntFunction() { return (Integer) invokeMethod(args); }
- note: explicitly casting may not be necessary, java probably does it automatically.
- On the C++ side, extend the current function invocation implementation to also accept a return value, convert the return value to QVariant (probably from QJSValue?), and then convert the QVariant's internal data into a Object type, returning it from the native call.
- This may need some synchronization, maybe waiting for the QML function to be invoked on the main Qt thread, so QFuture or something.
- split from
-
QTBUG-137112 QML function calls from Android
-
- In Review
-