Nyaruko
Nyaruko

Reputation: 4499

How to disable mouseEvent during pinch zoom?

I have a QGraphicsItem I have implemented mousePressEvent, mouseMoveEvent and mouseReleaseEvent for press and drag.

I also implemented the pinch-gesture for pinch zoom.

However I found during pinch zoom, the mouse events are also triggered because the touch events are auto translated into mouse events by sceneEvent().

How could I disable the mouse events when I have two touch points for pinch zoom?

Upvotes: 3

Views: 1188

Answers (1)

svlasov
svlasov

Reputation: 10455

You have to accept the touch events to avoid them being translated to mouse events. There is also Qt::AA_SynthesizeMouseForUnhandledTouchEvents attribute that enforces transaltion of unaccepted touch events, which is enabled by default:

All touch events that are not accepted by the application will be translated to left button mouse events instead. This attribute is enabled by default.

Upvotes: 2

Related Questions