简体   繁体   English

Linux中的多点触控

[英]Multitouch in Linux

I have two questions: 我有两个问题:

  1. How to simulate touch event in linux. 如何在linux中模拟触摸事件。
  2. How to work with multitouch on Qt in Linux. 如何在Linux上的Qt上使用多点触控。

You can simulate touch events by calling qt_translateRawTouchEvent directly. 您可以直接调用qt_translateRawTouchEvent来模拟触摸事件。 (This method is not documented, but it's in qapplication.cpp and it's exported). (此方法未记录,但它在qapplication.cpp并且已导出)。

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. 在你的情况下,使用(NULL, QTouchEvent::TouchScreen, touchPoints)调用此方法,其中touchPoints是用户当前触摸的点列表。 This should work in Qt 4.7 and 4.8 at least, possibly before in Qt 5 but I didn't check that. 这应该至少在Qt 4.7和4.8中有效,可能在Qt 5之前,但我没有检查。

对于多点触控问题,您可能想要查看Qt添加的Gestures API

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM