Below is the function I am using, in mousePressEvent function, it accepts event.

If I work on the image in its original size, then all the event.scenePos() is integer, there is no problem here, since wherever I put it, it's always on one integer pixel.

But I have to zoom in/out the images constantly, so when I put a point in the screen, it's not integer, for instance, the coordinate will be (10.3, 12,4)
(in zoom out mode, like 1.2x, 4.5x, it's almost impossible to put the point right at it's original size boundary)

One way to solve this is after I got the event.scenePos(), I round it to interger, like below.
Qt Code:
  1. def mousePressEvent(self, event):
  3. roundedPos = event.scenePos()
  4. roundedPos.setX(round(roundedPos.x()))
  5. roundedPos.setY(round(roundedPos.y()))
To copy to clipboard, switch view to plain text mode 

But this is not an ideal way, since there are too many places I need to do this.
Is there a way I can modify event, so as long as I use event.scenePos(), it is always integer, I don't need to do the rounding each time.