Subclass of QObject, qRegisterMetaType, and the private copy constructor

前端 未结 5 1982
有刺的猬
有刺的猬 2020-12-10 04:21

I have a class that is a subclass of QObject that I would like to register as a meta-type. The QObject documentation states that the copy-constructor should be private, but

5条回答
  •  醉酒成梦
    2020-12-10 04:57

    I use a separate copyValue(const MyClass & other) function to copy the data members that define the "values" of the MyClass instance. That ensures that I don't break the assumption of QObject unique identity, while still being able to duplicate the parts of the class that are defined at compile time.

提交回复
热议问题