Send a QObject with QDbus
I wrote a QDBus code able to send and receive QDBusMessage strings. Is there any way to send and receive QObjects too? What is the best way to encapsulate the transfered data ?
Any tip will be very helpful.
You can find information about that here
Hope it helps
Hi @SGaist ,
Thanks for answering. The link you sent me is exactly what I wanted!
I'm trying to pass an object created in one of my classes as an argument.
I have to declare my class with Q_DECLARE_METATYPE macro and call the function qRegisterMetaType, right? Do I have to use the Q_DECLARE_METATYPE macro in the class header?
The examples are only for structs. I'm trying to do something similar with classes, but without sucess. Have you got an example? I'm a dummie with Qt.
Q_DECLARE_METATYPE works with classes as well as struct you can follow the example all the same.
Yes, declare your class and just under the declaration and before the endif call Q_DECLARE_METATYPE
Thanks for the help @SGaist !
I extended my type, but there was a restriction with QOBject classes. Can't I use any base class with the macro Q_DECLARE_METATYPE?
You can't call
Q_DECLARE_METATYPE(MyQObjectDerivedClass)because QObject is not a copyable class