1

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 in QVariants.

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?

Nathan Osman
  • 71,149
  • 71
  • 256
  • 361

1 Answers1

0

You can have scriptable objects not derived from QObject but it's more work. It's discussed here

Jay
  • 13,803
  • 4
  • 42
  • 69