QWindow's touchEvent not called
-
On a Mac with a track pad, my QWindow based app does not get it's touchEvent virtual function override called.
In a similar QWidget based test app, I do get QTouchEvents.Is there something extra I need to do? The QTouchEvent documentation states that QWindow gets touch events automatically.
-
Try this
In constructor of the class - add this codesetAttribute(Qt::WA_AcceptTouchEvents, TRUE) ;
-
As an addition to what @BhanuKiranChaluvadi mentioned: If the
Qt::WA_AcceptTouchEvents
property is disabled, the touch events are simply transformed into mouse events:Qt::WA_AcceptTouchEvents Allows touch events (see QTouchEvent) to be sent to the widget. Must be set on all widgets that can handle touch events. Without this attribute set, events from a touch device will be sent as mouse events.