Forward Declaration Error on overriding
I have made a class Canvas which inherits class QGraphicsScene.
class Canvas : public QGraphicsScene
I have overriden the function mousePressEvent with the following.
/* This overridden is used to emit the signal to draw the state */
void Canvas::mousePressEvent(QGraphicsSceneMouseEvent *gevent)
//This is not working
qDebug("The value of the input event is \n");
qDebug("Mouse has been pressed");
emit(makestate(gevent)); //emit the signal here
My basic requirement is to get the pos() of the mouse clicked. The problem is that in the below function I cannot access gevent. The reported errors are as follows:
error: member access into incomplete type 'QGraphicsSceneMouseEvent'
note: forward declaration of 'QGraphicsSceneMouseEvent'
Hi and welcome to devnet,
You are missing
#include <QGraphicsSceneMouseEvent>in the file where you implement the method.
Thanks for your help!