开发者

Qt C++ QTouchEvent & TouchPoint Confusion

开发者 https://www.devze.com 2023-04-09 09:14 出处:网络
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

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 sam开发者_StackOverflow中文版e 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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消