How can I pass a qml function (from qml file) as a parameter to c++ function ?
-
Send a signal, and receive it in C++? I'm not sure I understand what you want to achieve.
-
this can be possible as sierdzio said, signal can be emitted from C++ this can be connected to with another signal using pointer of qml QObject .
e.g.@Object::connect(this, SIGNAL(requestXyz()), m_qmlScreenObject, SIGNAL(requestXyzQML()));@
and in QML
@function xyz()
{ ... }onXyz:{
xyz();
}@ -
Hello,
To avoid the signal boilerplate, you can use "QJSValue":http://qt-project.org/doc/qt-5.1/qtqml/qjsvalue.html
Please refer to "this post":http://qt-project.org/forums/viewthread/4521 for an example