Important: Please read the Qt Code of Conduct -

QGestureEvent management

  • I've developed a GUI application for Windows with QT 5.4 using Visual Studio 2013.
    I use gestures to let my GUI switch between panels within the main interface but I need to avoid to switch when the gesture is executed over certain widgets being part of such panels.

    The main interface uses QGestureRecognizer to receive QGestureEvents and to filter our swipes (so in the event method we switch panels when swipe gesture events are received).

    I've tried to use grabGesture in the specific widgets class in order to accept the event to avoid it to be propagated to the parent but i've found that the gesture event is sent to the parent before being received and accepted by my specific widget.

    I've also tried to use the QGestureEvent::widget() method to determine the widget on which the event is occurred but it always returns NULL.

    So, how could I avoid the receive the QGestureEvent when the swipe is executed on a specific widget within a panel ?

    I expected that the events are received by child widgets before being sent to the parents if not accepted and not sent to both parents and childs without rules.