Unsolved touchPoints.count in QQuickPaintedItem is always 1 in my android
-
I try to develop qt code to my mobile.
At first, I put my two finger on my screen. Then touchPoints.count=2.
But I find touchPoints.count always is 1 when I move my two finger on my
screen.bool WorkArea::event(QEvent event){
qDebug()<<"\n###"<<func<<"###";
qDebug()<<FUNCTION<<event->type();
qDebug()<<"#";
if (event->type() == QEvent::Gesture)
return gestureEvent(static_cast<QGestureEvent>(event));if(event->type() == QEvent::NativeGesture){ qDebug()<<event; //return gestureEvent(static_cast<QNativeGestureEvent*>(event)); QNativeGestureEvent* ss=static_cast<QNativeGestureEvent*>(event); qDebug()<<ss->value()<<ss->localPos(); //qDebug()<<(Qt::ZoomNativeGesture)ss->value(); } if(_touchDevice) { if(event->type() == QEvent::MouseButtonDblClick || event->type() == QEvent::MouseButtonPress || event->type() == QEvent::MouseButtonRelease || event->type() == QEvent::MouseMove || event->type() == QEvent::MouseTrackingChange) {
// event->ignore();
return false;
}if(event->type() == QEvent::Wheel) _touchDevice = false; } if(event->type() == QEvent::TouchBegin || event->type() == QEvent::TouchUpdate || event->type() == QEvent::TouchEnd ){ QTouchEvent *touchEvent = static_cast<QTouchEvent *>(event); qDebug()<<touchEvent->touchPoints().count()<<"$$$$$$"; for (int idxTouch=0;idxTouch<touchEvent->touchPoints().count();++idxTouch){ qDebug()<<touchEvent->touchPoints()[idxTouch].startPos(); qDebug()<<touchEvent->touchPoints()[idxTouch].lastPos(); }
_touchDevice = true;
}
// QTouchEvent *touchEvent = static_cast<QTouchEvent *>(event);
// qDebug()<<touchEvent->touchPoints().count()<<"$$$$$$";
//end
return QQuickPaintedItem::event(event);there are some reference for touchPoints.count, but there are still no solution for this qt problem.....
http://stackoverflow.com/questions/29825433/qgraphicsitem-sceneevent-handlerhttps://forum.qt.io/topic/53081/qcustomplot-and-multitouch-zoom/2
http://www.qcustomplot.com/index.php/support/forum/700
https://gitlab.com/pteam/korvins-qtbase/commit/91b48208f57b10f1b0378d1888fb96af73bc9fa3
https://github.com/ncp1402/ql-lineplot/issues/2
http://stackoverflow.com/questions/38281745/calculating-view-offset-for-zooming-in-at-the-position-of-the-mouse-cursor