PDA

View Full Version : QGraphicsView hoto to capture mouve event!



Zikoel
17th September 2011, 17:55
Hi,

I have a custom class that implements QGraphicsView and I have reimplemented the metods:



void Cavas::mousePressEvent(QMouseEvent *e){
qDebug()<<"Pressed";
}
void Canvas::mouseMoveEvent(QMouseEvent *e){
qDebug()<<"Moved";
}


The second method work correctly but the first don't work... what I can wrong??

Added after 1 35 minutes:

Sorry I have found the solution. I have write a wrond declaration in che ".h" file, I have write:



void mousePressEvent(QMouseEvent event);


instead of



void mousePressEvent(QMouseEvent *event);


Then I have created a new method than can't proces the event.

amleto
18th September 2011, 13:43
and here is a reason why everyone should COPY & PASTE their code, not re-write into the forum

Zikoel
18th September 2011, 15:45
The error was in my code not in the post. Hi.