2

I want to use a custom input device for multitouch input in a Qt application. I plan to create QTouchEvents based on my raw input data. I also want to generate custom gestures.

As far as I understand, I have to subclass QGestureRecognizer, create a QGesture for the widget I want to control and implement recognize() to filter my QTouchEvents and trigger the gesture when appropriate.

Now I have two questions:

  1. Is this the correct way to do things?

  2. How do I make sure that QTouchEvents still reach my widget (e.g. for dragging) when I already use them in my QGestureRecognizer? Or should all interaction with my widget be in form of gestures?

user1041903
  • 205
  • 2
  • 9
  • It sounds like OP and I are trying to achieve [similar things](http://stackoverflow.com/questions/23369431/why-does-my-qgesturerecogniser-not-receive-touch-events). Can anyone shed any further light on this problem? – sam-w Apr 29 '14 at 15:52

1 Answers1

3

My progress on this matter so far, should anyone find themselves in a similar situation:

1.: It may be the right way but it doesn't work. Even after registering my recognizer with the application, it does not receive any QTouchEvents. I therefore installed my recognizer as an eventFilter for the target widget.

2.: At least when using an eventFilter, one can pass the event to the original receiver. See http://doc.qt.io/qt-5/qobject.html#eventFilter.

Christophe Weis
  • 2,518
  • 4
  • 28
  • 32
user1041903
  • 205
  • 2
  • 9