View Full Version : Qgesture mouse or touch event

15th February 2014, 14:24
Hello all,

I am struggling with QGestureEvents, QMouseEvents inside a QGraphicsScene and view (and items)

I understand that gestures are not limited to touch events, and can be triggered by mouse actions too. Moreover, a touch event can be translated automagically in a mouse event. My problem is that I'm developing for several machines/os/hardware, some of them have only a mouse/keyboard, some others have only a touch-screen, and some others have both.

A touch event is automatically translated in a mousePressed/mouseReleased event (well, in some cases). I cannot find a way to know if it comes from a touch or from a real mouse-click. A long-mouse-click is automatically translated in a tapAndHoldGesture... apparently no way to know if it comes from a mouse or from a touch event.

It's a real problem if you want to write code that will accommodate all situations (for instance I dont want a long-click to be consider as a tapAndHoldGesture, nor do I want a touch-tap being translated in a mouse-click event).

So the question is:

Is there a way to know what is the input of an event (touch or mouse, say) ?

PS: using qt5.2.1 on Windows/Linux/Mac-OS/Android

5th December 2016, 20:33
Hi Matai,
did you ever find a solution to this problem?