Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. MultipointTouchArea inside target
Qt 6.12 LTS is out! See what's new in the release blog

MultipointTouchArea inside target

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 2 Posters 1.7k Views 1 Watching
  • 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    Hi everyone,

    can i use MultipointtouchArea inside a target like a PinchArea ? When i used the code below on a touch screen on win8 there is no problem. But on linux board with TUIO interface like QTuio i have some troubles.

    I use a delta because the target "rect" and "rect2" move so the toucharea moves too.

    Is the design good or not ? Why this code works on windows and not under linux ?

    Thanks all to give me some answers.

    My code :

    @Rectangle {
    id: rect
    width: 30; height: 30
    color: "yellow"

        MultiPointTouchArea {
            anchors.fill: rect
    
            onTouchUpdated: {
                var pt = touchPoints[0];
    
                if (pt === undefined){
                    return
                }
    
                var delta = Qt.vector2d(pt.x - pt.previousX, pt.y - pt.previousY);
                rect.x += delta.x
                rect.y += delta.y
            }
        }
    }
    
    Rectangle {
        id: rect2
        width: 30; height: 30
        color: "green"
    
        x: 300
    
        MultiPointTouchArea {
            anchors.fill: rect2
    
            onTouchUpdated: {
                var pt = touchPoints[0];
    
                if (pt === undefined){
                    return
                }
    
                var delta = Qt.vector2d(pt.x - pt.previousX, pt.y - pt.previousY);
                rect2.x += delta.x
                rect2.y += delta.y
    
            }
        }
    }@
    
    1 Reply Last reply
    0
    • jeremy_kJ Offline
      jeremy_kJ Offline
      jeremy_k
      wrote on last edited by
      #2

      If the goal is to make rect1 and rect2 draggable following a single touch point, MouseArea's drag.target property facilitates that without the javascript handler.

      Maybe someone can help with the Linux issues if you describe what is happening.

      Asking a question about code? http://eel.is/iso-c++/testcase/

      1 Reply Last reply
      0
      • ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #3

        The goal is a multi-user application, the MouseArea is not designed for two simultaneous touch.

        Is the MultiPointTouchArea can be used as this or not ? Because this method move the area and the rect at the same time. ( and should move all touchpoints but it not works )

        Before post bug reports for linux i have to be sure of my problem is not a design problem.

        tks jeremy

        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
        • Unsolved