views:

16

answers:

1

Hi,

I've a QGraphicsView with an image and a custom cursor. The cursor is made out of two QPen-DotLines. A x-axis dotLine and a y-axis dotLine. The cross of the two lines is the mouse-cursor position. The problem, when I zoom in, the cross is not more under the mouse-cursor position. For example, when the values of the mouse-cursor are x = 1.4235 ans y = 2.7732 then the dotLines are set on the position x = 1 and y = 2. But I want to have the dotLines on the float position (x = 1.4235 ans y = 2.7732). How can I do that.

Mouse position I get with

def mouseMoveEvent(self,event):
    ...
    ... self.grview.mapToScene(event.pos())
    ...

and the dotLines I set with setPos(). I think setPos() converts float to int. But I don't know how to work around. Hope someone of you has an helpful idea.

A: 

I found the problem. The guy who implemented some of the code before used "drawEllipse ( int x, int y, int width, int height )" and this converts float to int. So the only thing I had to do is to replace it with "drawEllipse ( const QPointF & center, qreal rx, qreal ry )". Sorry for the trouble and thank you.

Glad you got it figured out, thanks for the update.
Arnold Spence