Ok, I figured out how to detection using the MousePressEvent and MouseReleaseEvent and MouseMove event to do the "detect the mouse is dragging" part, now I need to retrieve the position of the mouse to do image-moving calculations. Does anyone have a snippet of code to do this?
I have this code currently, but it complains.
{
debug("I vus here 2!");
prevMousePoint = event->lastPos();
currMousePoint = event->pos();
if(mouseDown)
{
// xOffset = event->pos().x() - event->lastPos().x();
//yOffset = 1;
}
}
void mapScene::mouseMoveEvent( QGraphicsSceneMouseEvent * event)
{
debug("I vus here 2!");
prevMousePoint = event->lastPos();
currMousePoint = event->pos();
if(mouseDown)
{
// xOffset = event->pos().x() - event->lastPos().x();
//yOffset = 1;
}
}
To copy to clipboard, switch view to plain text mode
Complaint:
error: invalid use of undefined type `struct QGraphicsSceneMouseEvent'
error: invalid use of undefined type `struct QGraphicsSceneMouseEvent'
And it points to the lines where prevMousePoint and currMousePoint are. Both variables are of the type QPointF.
Bookmarks