QWebChannel pass QObject from JS
Unsolved
General and Desktop
-
Hello,
is it possible with a webchannel to pass objects (QObject derived) in js?
To explain it, i habe something like this:
c++class B; class A : public QObject { Q_OBJECT public slots: void pass_b(const B *b) {...} // do something with b } class B : public QObject { Q_OBJECT }
js
function someFunc() { var b = {}; // ignore how I got a b-object here ;) channel.objects.a.pass_b(b); }
As I see, a Json-object will be delivered. But when it comes to argument interpretation (
QMetaObjectPublisher::invokeMethod
) the json-object is passed to aQVariant
and is checked if the needed parameter for the called method isQVariant
or if the QVariant-object can be converted to the needed type. But a json-object can not be converted to aQObject
. There is no check withwrappedObjects
if the object is already known.PS: I used the qtwebchannel module from the qt5 github repo in dev-branch.