
Originally Posted by
d_stranz
Is the CFCConnection class derived from QObject somewhere in its inheritance hierarchy? Is the Q_OBJECT macro present in the class definition in the header file? Is MOC being run on the header file?
Yes, yes and yes.
The code to demonstrate the first two points:
#include <QObject> //Included QObject
#include "ResourceItem.h"
#include "MonWindow.h"
#include "FCTab.h"
#include "ResourceItem.h"
#include "FCAbstract.h"
#include "FCInterface.h"
class CFCConnections: public CResourceItem
{
Q_OBJECT //QObject MACRO
public:
~CFCConnections();
private:
CFCInterface* pParent;
};
#endif
#include <QObject> //Included QObject
#include "ResourceItem.h"
#include "MonWindow.h"
#include "FCTab.h"
#include "ResourceItem.h"
#include "FCAbstract.h"
#include "FCInterface.h"
class CFCConnections: public CResourceItem
{
Q_OBJECT //QObject MACRO
public:
CFCConnections(QObject*);
~CFCConnections();
private:
CFCInterface* pParent;
};
#endif
To copy to clipboard, switch view to plain text mode
That was the FCConnections.h code. And I know that MOC has run on the header file because I had to manually change its build step to include MOC. This image below shows the inheritance hierarchy. CFCConnections is derived from CResourceItem which has QObject as its base class.
1.jpg
POSSIBLE SOLUTION
I just had to change the line
CFCConnections* f_pConn=0;
CFCConnections* f_pConn=0;
To copy to clipboard, switch view to plain text mode
to
CFCConnections* f_pConn;
f_pConn = new CFCConnections(this);
CFCConnections* f_pConn;
f_pConn = new CFCConnections(this);
To copy to clipboard, switch view to plain text mode
Bookmarks