只是想了解一下 QTouchEvent。任何帮助/建议表示赞赏。
具体来说,当触发触摸事件时(例如 TouchBegin),我有点困惑;这是否仅代表一个独特的接触点?如果是这样,为什么 QTouchEvent 中有一个触摸点列表?
如果不是,Qt 是否会将给定时间段内发生的多个 TouchBegin 实例组合在一起,并将其作为一个事件传递,并将点列表封装在事件中?同样,QTouchUpdate 事件将包含有关当时正在更新的多个触摸点的信息?
我还假设;
QTouchEvent::TouchPoint::id
将在 TouchBegin、TouchUpdate 和 TouchEnd 中保持一致。这意味着在不同的触摸事件中,如果我看到一个具有相同 id 的点,则这两个事件所指的是同一个触摸点。这个假设正确吗?
仅供参考:我已经使用 TUIO 一段时间了,所以如果有人熟悉 Qt 和 TUIO,比较解释对我来说会更容易理解。我也阅读了 Qt 文档,但无法找到我的问题的答案。
尽管如此,我还是非常感谢任何帮助。
谢谢。
Just trying to wrap my head around QTouchEvent. Any help/advice is appreciated.
Specifically I'm a bit confused when a touch event is fired (for e.g. TouchBegin); does this represent only one unique touch point? If so why is there a list of touch points inside QTouchEvent?
If not, is it the case that Qt will group together several TouchBegin instances that happen in a given time fraction and deliver it as one event, with the list of points encapsulated in the event? Likewise a QTouchUpdate event will contain information about several touch points that are being updated at that time?
Also I assume that;
QTouchEvent::TouchPoint::id
will remain consistent throughout TouchBegin, TouchUpdate and TouchEnd. Meaning that in different touch events if I see a point with the same id, it is the same touch point that both events are referring to. Is this assumption correct?
FYI: I've been working with TUIO for sometime, so if someone is familiar with both Qt and TUIO a comparative explanation would be much easier for me to understand. I've read through Qt documentation as well, but wasn't able to find an answer to my question.
Still I'd really appreciate any help at all.
Thank you.
发布评论
评论(1)
不同平台上事件的具体报道方式似乎有所不同。如果用两根手指按下它,它可以从单个触摸点 (TouchBegin) 开始,并立即跟随一个新的 QTouchEvent 具有两个 TouchUpdate 点。但它也可以将两个触摸点分组到 TouchBegin QTouchEvent 中。但我也目睹了两个 TouchBegin 事件,尽管这是被禁止的事件(请参阅 QTouchEvent 文档)。
开始之后,TouchUpdates 又出现了差异。有时,即使抬起一根手指,您也总是会得到两分(或手指向下的数量)。在这种情况下,抬起的手指“id”的压力为 0。或者,您将获得实际已关闭的接触点 ID 的数量。
了解这些事件如何生成的最佳方法是安装事件过滤器并按下事件时观察事件。
How exactly the events are reported seem to differ in different platforms. If you press it with two fingers, it can start with a single touch point (TouchBegin), and immediately follow that with a new QTouchEvent with two TouchUpdate points. But it can also group two touch points into the TouchBegin QTouchEvent. But I have also witnessed two TouchBegin events, event though this is kind of forbidden (see "Touch Point Grouping" in the QTouchEvent doc).
After the begin, there are again differences in the TouchUpdates. Sometimes you always get two points (or the amount you have fingers down) even if you lift one finger. In this case the pressure is 0 for the lifted finger "id". Alternatively you'll get the amount of touchpoint ids that are actually down.
The best way to understand how these are generated is to install an eventfilter and observe the events while you press them.