Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. touchPoints.count in QQuickPaintedItem is always 1 in my android
Qt 6.11 is out! See what's new in the release blog

touchPoints.count in QQuickPaintedItem is always 1 in my android

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
1 Posts 1 Posters 819 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • zenghsingZ Offline
    zenghsingZ Offline
    zenghsing
    wrote on last edited by
    #1

    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-handler

    https://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

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved