I'm trying to write a class with two basic characteristics:
- It needs to be scriptable - the class contains a number of properties and methods decorated with
Q_INVOKABLE
that are exposed to scripts. - It needs to be serializable so that it can be registered with
qRegisterMetaTypeStreamOperators()
for storing inQVariant
s.
As far as I can tell, I need to derive from QObject
in order to make the class scriptable. However, in order to register the class with qRegisterMetaTypeStreamOperators()
, it seems like the class needs to have a default copy constructor - something a QObject
-derived class cannot have.
Is there any way to achieve both goals?