[SOLVED] QObject::QObject’ : cannot access private member declared in class ‘QObject’ !
Some of the functions in this class I defined uses some Qt children methods, so I had to have the Q_OBJECT macro. However, this is the sole error that comes up when I attempt to compile, and I neither know how to interpret it nor to fix it. Any input?
- #ifndef HARDTRIGGER_H
- #define HARDTRIGGER_H
- #include
- #include <QObject>
- {
- Q_OBJECT
- public:
- unsigned long UID;
- tPvHandle Handle;
- tPvFrame Frame;
- tPvUint32 Counter;
- char Filename[20];
- bool Abort;
- private slots:
- void WaitForCamera();
- bool CameraGet();
- bool CameraSetup();
- void CameraUnsetup();
- bool CameraStart();
- void CameraStop();
- bool CameraSnap();
- };
- #endif // HARDTRIGGER_H
1 reply
That must happen because the default constructor of QObject is private, so define an constructor for your class to pass a QObject* parent to the QObject constructor
- {
- Q_OBJECT
- public:
- //...
Also you should make sure to disable the copy for your class using q_disable_copy or private copy c-tor and assignment operator [qt-project.org]
You must log in to post a reply. Not a member yet? Register here!


