Call object.callbackA.connect(callbackB) in C++
-
How can I call:
var object = component.createObject(pageParent);
object.callbackA.connect(callbackB)in C++ ?
-
It's all in the "documentation":http://qt-project.org/doc/qt-5.0/qtqml/qtqml-cppintegration-interactqmlfromcpp.html. And "here":http://qt-project.org/doc/qt-4.8/qtbinding.html#exchanging-data-between-qml-and-c.
-
Hey Sierdzio,
The documantation show how to connect a C++ function.
I want to connect a JS function to another JS function through C++. -
As long as that function is visible to Meta Object System, it will work. If it's not visible there, it will not work.
-
Its a JS function on QML.
Will it work ? -
I suppose so. You need to try it. Cast the object to a QObject (or QQuickItem) and then it should be possible to connect signals and slots there.
-
But there is now SLOT,
Just a JS function -
Try and see. Slots are always connected by name, so maybe the system does not care that it's a JS function.
-
How do I pass the name of this JS function if on C++ its a QJSValue ?
-
You are about to prove me wrong, I think ;P Maybe try getting it using "QMetaObject::indexOfMethod":http://qt-project.org/doc/qt-5.0/qtcore/qmetaobject.html#indexOfMethod. Or "QMetaObject::normalizedSignature":http://qt-project.org/doc/qt-5.0/qtcore/qmetaobject.html#normalizedSignature.