Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Pass list of TouchPoints from QML to C++

Pass list of TouchPoints from QML to C++

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 381 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.
  • M Offline
    M Offline
    Michael Sjostrom
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • dheerendraD Offline
      dheerendraD Offline
      dheerendra
      Qt Champions 2022
      wrote on last edited by
      #2

      I suspect that this is not possible. TouchPoint may not be QTouchPoint. May be you can try passing the required values for each touchpoint.

      Dheerendra
      @Community Service
      Certified Qt Specialist
      http://www.pthinks.com

      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