Hello all,

I'm trying to write a global proceedure to convert all QTapAndHoldGesture 
events to mouse double click events. I thought this should be trivial, but 
it's really stumping me.

I setup an event filter globally for my QApplication and grab the gesture 
as follow:
app.installEventFilter(&myobj);
mainWin->grabGesture(Qt::TapAndHoldGesture);

And then I have an event filter as follows:

bool myObject::eventFilter(QObject *obj, QEvent *e)
{
   if(e->type() == QEvent::Gesture)
   {
     QGestureEvent *event = static_cast<QGestureEvent*>(e);
     if(QGesture *gest = event->gesture(Qt::TapAndHoldGesture))
     {
       QTapAndHoldGesture *tah = static_cast<QTapAndHoldGesture *>(gest);
       QMouseEvent dblClk(QEvent::MouseButtonDblClick, 
tah->position().toPoint(), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
       QApplication::sendEvent(obj, &dblClk);
       return true;
     }
   }
}

I receive the gesture events fine, but for some reason when none of my 
widgets receive the double click events. I've tried lots of different 
options for instantiating my QMouseEvent. I've tried calling grabMouse on 
the widget before sending the event, but still nothing receives double 
click events. Does anyone have an idea of why none of my widgets receive 
the double click events?

Thanks!

Josh
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to