Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QObject subclass with properties used as a property in another QObject subclass?
medvedm last edited by
Here is what I'm trying to do:
class Thing1 : QObject
QPROPERTY(quint16 someStuff READ getsomeStuff WRITE setsomeStuff)
//all the junk you need
//including constructor, copy constr, destructor
class Thing2 : public QObject
QPROPERTY(Thing1 aThing READ getaThing WRITE setaThing)
//all the junk you need.
The problem is this: when you implement the setaThing function, you get a compile error because the QObject::operator= is private. So is what I am trying to do completely impossible? I can't have a class with properties as a property for another class with properties?
andre last edited by
Yes, it is impossible. QObject cannot be copied, and properties need to be able to be copied. The only thing you could do is to use a pointer to your Thing1 as the property in Thing2.
dbzhang800 last edited by
why object of QObject or its subclass can't be copy can be found here: