Manual event controlling in C++ from e.g. MultiPointTouchArea
-
Hey,
I already posted this just briefly in annother post(containing annother topic) in the mobile section, but I think it is worth an own topic.
As I posted I'm quite disappointed with the touch interaction(in general as also the example, which has the same name). The Flickable element feels all but natural(not reacting smoothly(not in fps sense I mean), kinda breaking before flicking...), like the native api elements in IOS or Android. Well before I "discovered" recently that QtQuick might be a better approach to go mobile than QtWidgets, I had to implement myself a gesturedetection that recognizes flicks. My approach was simple but effective: I just saved all 10 last(or less if there were no more) touchpoints in a queue and after releasing the touchscreen it just calculated the average velocity, those touchpoints had. The result was better than expected, at least it felt much better than the flickable that QML has to offer. The only thing that might disrupt a very little was if you catapulted your finger over the touchscreen, that it hasn't accelerated that much like in Android. Because I was interested in how they realised it in Android, I looked up the sources and was flabbergasted when I saw the effort, that was made, to just recognize the velocity correctly: several approaches, once the thing I tried, then a square linear regression of second degree(which apparantly works the best). A lowpass filter and so on... Have a look on the sources: https://android.googlesource.com/platform/frameworks/native/+/master/libs/input/VelocityTracker.cpp
My question/wish is could be made something similar with the current flick element, because the state that it has now, I just want to use my own implementation...
And that is for now my question, is there any possibility to pass (best would be) complete raw events to c++? Is there any nice guide to real(not just the high level constructs like Flickable etc.) event handling in qt Quick, the best I saw was MultiPointTouchArea, where I could do something with the events in C++. And there is yet the next question, how can I pass the whole MultiPointTouchArea, or at least the Touchpoints as object to C++? My only Idea was, to extract the "low-level" information like position(over touchpoint.x/y/previousX ...) and maybe which touchpoint was passed, but is there a more elegant way?
Then more directly to the Qt developers: why is the GestureArea from Qt 4.8 gone? This would be exactly something I would wish, custom Gestures easily binded in QML...
I hope I could explain a bit my problem...
Best Regards
Philipp