C++ Qt Reflection with Copy and Assignment
问题 As the QObject documentation and many others explain, a QObject has an identity and thus hides its copy constructor and assignment operator. However, I'm not deriving from QObject for its dynamic properties feature or the signals/slots feature. I only want reflection , or the ability to access Foo::staticMetaObject . class Foo : public QObject { Q_OBJECT Q_ENUMS(Color) public: enum Color { Blue, Red, Pink }; private: Color color; }; Q_DECLARE_METATYPE(Foo::Color) I then can't copy Foo with: