[Interest] Q_GADGET vs Q_OBJECT

Russell, Matthew MRussell at neptec.com
Thu Apr 13 20:31:23 CEST 2017

Why can my Q_GADGET be read perfectly in QML (JS) but not my Q_OBJECT?

I created a class, registered it (Q_DECLARE_METATYPE), and then push instances of it into a QVariantMap.  If the object is a Q_GADGET my JS can read it perfectly, but when I switch it to a Q_OBJECT, the objects are blank.

I placed some code examples on SO here: http://stackoverflow.com/questions/43398740/qml-can-see-my-q-gadget-but-not-q-object

Basically I've narrowed it down to Q_GADGET vs Q_OBJECT, nothing else seems to make any difference.  I'd prefer to use Q_OBJECT so that I can use signals and other objects in the QML/JS can bind to them.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20170413/6acd56f9/attachment.html>

More information about the Interest mailing list