PDA

View Full Version : Swipe gesture not recognized



Luc4
24th March 2010, 14:32
Hi! I'm trying to enable a swipe gesture. I created a test class like this following the documentation and the example:


GestureLabel::GestureLabel(QWidget *parent) :
QWidget(parent)
{
grabGesture(Qt::SwipeGesture);
}

bool GestureLabel::event(QEvent *e)
{
if (e->type() == QEvent::Gesture)
return gestureEvent(static_cast<QGestureEvent*>(e));
return QWidget::event(e);
}

bool GestureLabel::gestureEvent(QGestureEvent *event)
{
if (QGesture *swipe = event->gesture(Qt::SwipeGesture))
swipeTriggered(static_cast<QSwipeGesture *>(swipe));
return true;
}

void GestureLabel::swipeTriggered(QSwipeGesture *gesture)
{
QMessageBox::information(this, "Gesture!", "Gesture!");
}

Seems not to recognize swipes. I tried to put a breakpoint in line:


return gestureEvent(static_cast<QGestureEvent*>(e));

and seems the execution doesn't stop there. Is there anything I'm doing wrong? Am I lacking anything?
Thanks for any advice!

multik
22nd May 2014, 08:25
sorry for bumping. I have the same problem: no swipe gesture detection at all. Tap, tapandhold, pan, pinch works ok ..

did you find solution?

laurelmarcel
16th December 2014, 15:14
hi,

i want to make pinch gesture but i d'ont know how can i begin ? did sommeone to help me please ?

hi,

i want to make pinch gesture but i d'ont know how can i begin ? did sommeone to help me please ?