I have a following user class:
class MyLine : public QLineEdit
{
Q_OBJECT
Q_ENUMS(Base::LineState)
public:
explicit MyLine (QWidget *parent = 0);
};
Also I have base class containing all global enums:
class Base
{
Q_GADGET
Q_ENUMS(LineState)
public:
// The states for MyLine
enum LineState
{
Empty, Correct, Wrong
};
};
When I compiled this code I got a following error: undefined reference to "Base::staticMetaObject"
What need to do?
You don't need first
Q_ENUMS(Base::LineState)inMyLineclass, you are generating this meta data inBaseclass.Also you have to add header file with
Baseclass to list ofHEADERSin pro file so the moc tool could generate code for meta data.