6

I have two questions:

  1. How to simulate touch event in linux.
  2. How to work with multitouch on Qt in Linux.
sepehr
  • 17,110
  • 7
  • 81
  • 119
Alex Raeder
  • 661
  • 6
  • 10

2 Answers2

3

You can simulate touch events by calling qt_translateRawTouchEvent directly. (This method is not documented, but it's in qapplication.cpp and it's exported).

You want to put this at the top of your file:

// forward-declaration of Qt internal function
Q_GUI_EXPORT void qt_translateRawTouchEvent(QWidget *window, 
                                        QTouchEvent::DeviceType deviceType,
                                        const QList<QTouchEvent::TouchPoint> &touchPoints);

The function call syntax is :

qt_translateRawTouchEvent(targetWidget, deviceType, points.values());

In your case call this method with (NULL, QTouchEvent::TouchScreen, touchPoints) where touchPoints is your list of points being currently touched by the user. This should work in Qt 4.7 and 4.8 at least, possibly before in Qt 5 but I didn't check that.

David Faure
  • 1,836
  • 15
  • 19
3

For the multitouch question, you are probably wanting to have a look at the Gestures API that Qt has added.

Caleb Huitt - cjhuitt
  • 14,785
  • 3
  • 42
  • 49