PDA

View Full Version : Mouse movement problem in QGraphicsView



zgulser
15th May 2009, 07:46
Hi,

I have a QGraphicsItem which is working as the new mouse icon when the graphics view has mouse tracking on itself. I did this operation by something like the following

CursorItem* myQGraphicsItemAsCursor = new CursorItem()

QGraphicsView::mouseMoveEvent( ... pEvent)
{
...
myQGraphicsItemAsCursor->move(pEvent->x(), pEvent->y())
...
}

CursorItem::move( int x, int y)
{
QGraphicsItem::setPos(x, y);
...
}


The problem is it really seems that mouse suffers from something when it hovers on the view. It couldn't catch all mouse moves. What could be the possible problems?


Thanks in advance

aamer4yu
15th May 2009, 07:53
Might be improper translation of view coordinates to scene coordinate. Since in view, you get pos based on view coordinates, and when you setPos on item, it sets pos on scene cordinates...

zgulser
15th May 2009, 08:01
Hi,

I mapped the view coordinates to scene's and pass them into the move(...) method but it didn't worked:(