Pass list of TouchPoints from QML to C++
-
I'm using a MultiPointTouchArea in QML and I somehow need to pass its list of TouchPoints to C++.
My first option would be to pass the list of touchpoints whenever onPressed, onReleased and onUpdated is triggered, e.g.QML:
MultiPointTouchArea { minimumTouchPoints: 1 maximumTouchPoints: 2 touchPoints: [ TouchPoint { id: touch1 }, TouchPoint { id: touch2 } ] onPressed: { myCPlusPlusClass.onPressed(touchPoints) } }C++:
void myCPlusPlusClass::onPressed(const QList<QTouchEvent::TouchPoint>& list) { // Do something }I have registered QListQTouchEvent::TouchPoint as a metatype like so:
qRegisterMetaType<QList<QTouchEvent::TouchPoint>>("QList<QTouchEvent::TouchPoint>");But all i get is a list full of nullptrs or similar.
My second best option would be to pass each TouchPoint individually but I run into the same problem.
Is this possible to solve?
If not, what are my options to pass the info i need to C++ side? -
I suspect that this is not possible. TouchPoint may not be QTouchPoint. May be you can try passing the required values for each touchpoint.