Can\'t get a property of a C++ object inside a QML code. Object is passed as a parameter to the signal.
Expected that in QML, the property text
of the <
The release notes for Qt 5.5 says for the new features:
- Qt Core
- You can now have Q_PROPERTY and Q_INVOKABLE within a Q_GADGET, and there is a way to query the QMetaObject of such gadget using the QMetaType system
Indeed, compiling and running your example with Qt 5.4 gives the same result as yours whereas with Qt 5.5 I got Record
correctly recognised, i.e. I got as a result:
qml: Record(abc)
qml: abc
Also, as stated in the Q_DECLARE_METATYPE
documentation, the type passed to the macro - Record
in this case, should provide (1) a public default constructor, (2) a public copy constructor and (3) a public destructor. Since Record
is a very simple class, there's no need to provide a copy constructor as the default one is sufficient.