Let's make one thing clear first. QVariant (which is what Qt property system uses) requires its "members" to be copiable (or to say properly to implement a public copy constructor). QObject doesn't fill this requirement, it's "identity-based" and we operate on it using pointers. So if your A, B, C, D classes inherit QObject somewhere along the line, they can't be put into QVariant (as objects). You can only put pointers to them into QVariant. Trying to go around it will sooner or later result in failure (even if you provide a copy constructor for your object, you still won't be able to copy the QObject sitting below your class).
So you need to answer two questions first:
- do I need my objects to inherit QObject?
- do I need my objects to be values of properties (aka "what benefit do I have from my objects being values of properties")?
Bookmarks