0

I have a problem with Q_DECLARE_METATYPE:

Severity Code Description Project File Line Suppression State Error C2280 'MyNamespace::MyClass::MyClass(const MyNamespace::MyClass&)': attempting to reference a deleted function BksMtRisk C:\qt2\5.15.2\msvc2019_64\include\QtCore\qmetatype.h 825

What is wrong?

namespace MyNamespace {
class MyClass : public AbstractMyClass
{
 
}
}
Q_DECLARE_METATYPE(MyNamespace::MyClass)
drescherjm
  • 10,365
  • 5
  • 44
  • 64
  • I don't know but for my situation need function `MyClass (const MyClass & other)` , why I need create this function??? – topaz23 Oct 14 '22 at 10:50
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Oct 18 '22 at 08:22

1 Answers1

1

From the Qt documentation Q_DECLARE_METATYPE(Type):

This macro makes the type Type known to QMetaType as long as it provides a public default constructor, a public copy constructor and a public destructor. It is needed to use the type Type as a custom type in QVariant.

So my guess is that your base class is missing one of the required Public Constructors

For more information read this: https://stackoverflow.com/a/31266254

Rawen
  • 96
  • 3