Mouse tracking on QGraphicsView

  • Hello!

    I have a class derivated of QGraphicsView. I had to enable the mouse tracking property because I have to get the mouse position coordinates. Now, the problem is that when I move the mouse on the QGraphicsView, I can move the image inside "without clicking it".

    How could I disable this first click?

  • @ivanicy

    Try setting to false,l setflag()

    setFlag(QGraphicsItem::ItemIsMovable, false);

  • Thank you very much for answer me but this fix doesn't work. The problem is: at first, when I move the mouse, the image moves too, but, when I click the image, the movement stops, and I want to stop the movement always.

  • If image moves means u must be setting image coordinates with mouse move coordinates. Can u paste the sample code ?

Log in to reply