If you want to declare and implement a QObject subclass in you cpp file, you have to manually include the moc file.
For example: (file main.cpp)
struct SubObject : QObject
{
Q_OBJECT
};
//...
#include "main.moc"
You have to rerun moc (make qmake
) after adding the #include
statement.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…