I want to use my objects as QVariants and for queued connections. Therefore I want to use Q_DECLARE_METATYPE(My_Item) and from the documentation I learned that I need a public copy constructor. I tried to write one, but I failed. Than I did read this copy constructor of derived QT class and the answer by BЈовић. From there I understand that what I intended to do is not going to work. What do I have to do make my objects useable for the Metatypesystem?
My_Item is based on My_Super_Item, which look like this:
class My_Item: public My_Super_Item { Q_OBJECT Q_INTERFACES(QGraphicsItem) public: explicit My_Item(Application *a, QString astring); ... } and
class My_Super_Item : public QObject, public virtual QGraphicsItem { Q_OBJECT Q_INTERFACES(QGraphicsItem) public: My_Super_Item(My_Application *a, QString astring); ... }
QObjects. Why do you want to put them inQVariantanyway? You don't needQ_DECLARE_METATYPEfor queued connections.qRegisterMetaType.