I am trying to get QGesture events in my widget (subclass of QWidget). I have the following in my constructor:
setAttribute(Qt::WA_AcceptTouchEvents);
setAttribute(Qt::WA_TouchPadAcceptSingleTouchEvents);
grabGesture(Qt::SwipeGesture);
grabGesture(Qt::PanGesture);
grabGesture(Qt::PinchGesture);
And I have my own event function:
bool MyWidget::event(QEvent *event)
{
if(event->type() == QEvent::Gesture)
{
TRACE("Gesture");
}
if(event->type() == QEvent::GestureOverride)
{
TRACE("Gesture override");
}
if(event->type() == QEvent::Enter)
{
TRACE("Mouse enter");
}
return true;
}
On windows 7 I receive mouse enter events but nothing else. (I am using the ms surface sdk input simulator to generate touch events as suggested here). Very occasionally I get the message
QGestureManager::deliverEvent: could not find the target for gesture.
but cannot easily reproduce this.
Why am I not receiving gesture events?