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. MultiPointTouchArea problem. Letting single touches through.

MultiPointTouchArea problem. Letting single touches through.

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
10 Posts 4 Posters 2.5k 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.
  • I Offline
    I Offline
    Izba
    wrote on last edited by
    #1

    Hello everyone,

    I know this has been asked a lot, but i could not find any answers how to really work around this problem so here it goes.

    I'm trying to make MultiPointTouchArea overlay on my software, so that it would catch Gesture events with 2 or more fingers. The problem is that when i set the z value to something like 99, every MouseArea is left below it. It seem's that when using normal mouse this is no problem cause i can set MultiPointTouchArea mouseEnabled value to false, so it lets mouseEvents through, but with touchscreen this doesn't work because of the TouchArea doesn't see one finger touch as a mouseEvent.

    Has anyone come up with any way to reimplement the MultiPointTouchArea so it would have something like MouseArea with the propagateComposedEvents, or that when it catches a touchEvent it would re-send same event to lower levels?

    Thanks in advance,
    -Izba

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

      In your case handle onPressed(...) signal in touchArea and emit user defined signal. Catch this user defined signal in lower layer objects.

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

      I 1 Reply Last reply
      0
      • I Izba

        Hello everyone,

        I know this has been asked a lot, but i could not find any answers how to really work around this problem so here it goes.

        I'm trying to make MultiPointTouchArea overlay on my software, so that it would catch Gesture events with 2 or more fingers. The problem is that when i set the z value to something like 99, every MouseArea is left below it. It seem's that when using normal mouse this is no problem cause i can set MultiPointTouchArea mouseEnabled value to false, so it lets mouseEvents through, but with touchscreen this doesn't work because of the TouchArea doesn't see one finger touch as a mouseEvent.

        Has anyone come up with any way to reimplement the MultiPointTouchArea so it would have something like MouseArea with the propagateComposedEvents, or that when it catches a touchEvent it would re-send same event to lower levels?

        Thanks in advance,
        -Izba

        J.HilkJ Offline
        J.HilkJ Offline
        J.Hilk
        Moderators
        wrote on last edited by J.Hilk
        #3

        @Izba
        you can set the propagateComposedEvents property to true.

        http://doc.qt.io/qt-5/qml-qtquick-mousearea.html#propagateComposedEvents-prop

        that however may only apply to "normal" mouseAreas, I'm unsure.


        Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


        Q: What's that?
        A: It's blue light.
        Q: What does it do?
        A: It turns blue.

        1 Reply Last reply
        0
        • dheerendraD dheerendra

          In your case handle onPressed(...) signal in touchArea and emit user defined signal. Catch this user defined signal in lower layer objects.

          I Offline
          I Offline
          Izba
          wrote on last edited by
          #4

          Hi @dheerendra ,

          Well yeah i could use onPressed signal and turn it to other signal, but that's not very effective when i have big layout under the MultiPointTouchArea.

          @J-Hilk

          I tried that even with the mouseArea on top of MultiPointTouchArea. It doesn't work with the propagateComposedEvents. This way it only takes the mouseArea event and MultiPointTouchArea, doesn't see any touch events.

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

            @lzba, you are right. It is not so good way. However that is the only option. We may need to write some generic component to take care of this.

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

            I 1 Reply Last reply
            0
            • dheerendraD dheerendra

              @lzba, you are right. It is not so good way. However that is the only option. We may need to write some generic component to take care of this.

              I Offline
              I Offline
              Izba
              wrote on last edited by
              #6

              @dheerendra, is there a way to listen to a touch device by a c++ class and get those multipoint touches without stealing it? Cause it really doesn't have to be full screen MultiPointTouchArea, if i could just listen to raw input data and calculate gestures from that. I tried to look at QTouchDevice, but that class, doesn't give me any raw data, only names and capabilities.

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

                It may not be direct. It may be round about way of doing the things. You can use eventFilters and try catching the events. Filter the events of your interest.

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

                I 1 Reply Last reply
                0
                • L Offline
                  L Offline
                  Larvae
                  wrote on last edited by
                  #8

                  MultiPointTouchArea's minimumTouchPoints property set to 2 doesn't work?

                  1 Reply Last reply
                  0
                  • dheerendraD dheerendra

                    It may not be direct. It may be round about way of doing the things. You can use eventFilters and try catching the events. Filter the events of your interest.

                    I Offline
                    I Offline
                    Izba
                    wrote on last edited by
                    #9

                    @dheerendra, well ill try to scrape events straight from /dev/input/event0.

                    @Larvae, No it still doesn't let one finger touches trough.

                    Ill try to make solution for this problem and come back with it later.

                    1 Reply Last reply
                    0
                    • L Offline
                      L Offline
                      Larvae
                      wrote on last edited by Larvae
                      #10

                      How about this? It works for click and release, but I have some trouble with pressed:

                      import QtQuick 2.11
                      import QtQuick.Window 2.11
                      
                      Window {
                          id: root
                          visible: true
                          width: 640
                          height: 480
                          title: qsTr("Hello World")
                          
                          Text {
                              id: text
                              text: "No Input"
                          }
                          
                          MouseArea{
                              id: m1
                              z:1
                              anchors.fill: parent
                              onClicked: {
                                  console.log("Click!")
                              }
                              onPressed: {
                                  text.text = "MouseAreaPressed at x=" + mouse.x + " y=" +mouse.y
                                  console.log("Pressed!")
                              }
                              onReleased: {
                                  text.text = "No Input"
                                  console.log("Released!")
                              }
                          }
                          
                          MultiPointTouchArea {
                              id: multiPointArea
                              z:2
                              anchors.fill: parent
                              maximumTouchPoints: 2
                              minimumTouchPoints: 2
                              onPressed: {
                                  text.text = "Multi Point Input Pressed"
                              }
                              onReleased: text.text = "No Input"
                              MultiPointTouchArea {
                                  id: singlePointArea
                                  anchors.fill: parent
                                  maximumTouchPoints: 1
                                  minimumTouchPoints: 1
                                  touchPoints: TouchPoint { id: point }
                                  onPressed: {
                                      text.text = "Single Point Input Pressed"
                                      multiPointArea.visible = false
                                      var item = parent.parent.childAt(point.x, point.y)
                                      multiPointArea.visible = true
                                      console.log(item)
                                      if (item && typeof(item["clicked"]) === "function") {
                                          item["clicked"](point);
                                      }
                                  }
                                  onReleased:  //text.text = "No Input"
                                  {
                                      text.text = "No Input"
                                      var item2 = parent.parent.childAt(point.x, point.y).nextItemInFocusChain(true)
                                      multiPointArea.visible = false
                                      var item = parent.parent.childAt(point.x, point.y)
                                      multiPointArea.visible = true
                                      console.log(item)
                                      if (item && typeof(item["released"]) === "function") {
                                          item["released"](point);
                                      }
                                  }
                              }
                          }
                      }  
                      
                      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