5

A MultiPointTouchArea with mouseEnabled:true and minimumTouchPoints:1 doesn't appear to support mouse movements when the mouse button is not pressed (tested on MacBook Air with mouse and Windows 10 with mouse) nor single point touch events (tested on a Macbook Air trackpad).

import QtQuick 2.5

Rectangle {
    id: root
    width: 800
    height: 300

    MultiPointTouchArea {
        anchors.fill: parent
        mouseEnabled: true
        minimumTouchPoints: 1
        maximumTouchPoints: 10

        onUpdated: {
            for (var touch in touchPoints)
                console.log("Multitouch updated touch", touchPoints[touch].pointId, "at", touchPoints[touch].x, ",", touchPoints[touch].y)
        }
    }
}

In the above example, console output is only generated for

  • 2+ touch points
  • mouse with button pressed
  • 1 touch point with trackpad pressed

I have tried layering a MultiPointTouchArea over a MouseArea and setting mouseEnabled:false also. This lets mouse click events to propagate but mouse PositionChanged signals do not get received by the MouseArea. So the end result is the same as above.

Is there a way to support:

  • 1+ touch points (including on trackpad)
  • mouse without button pressed
Paul Masri-Stone
  • 2,843
  • 3
  • 29
  • 51
  • Mouse without a pressed button is not supposed to generate any touch events - why do you expect it to? It would make most applications unusable. – Kuba hasn't forgotten Monica Jan 27 '16 at 19:17
  • 1
    Sorry but I disagree. In the same way that you can set hoverEnabled on a MouseArea and track entry, exit and mouse moves within it, this functionality is indeed very useful. For the app I am developing it is vital in fact that certain areas of the screen behave in this way. Other than questioning validity can you offer a solution? – Paul Masri-Stone Jan 27 '16 at 22:48
  • 1
    A mouse area is for mouse tracking. A touch area is for touch input, not mouse tracking. If you want to track mouse, you need to add the mouse area. That's pretty simple, right? You're trying to use the touch area to do what it wasn't supposed to do. "Doctor, it hurts when I do that" "Well, don't do it, then" :) – Kuba hasn't forgotten Monica Jan 28 '16 at 13:42
  • I agree with that. See the last section of my question: "I have tried layering a MultiPointTouchArea over a MouseArea...". Do you have a solution because the mouse events are being swallowed. I saw this reported bug https://bugreports.qt.io/browse/QTBUG-31047 but this is shown as closed. Have I missed something? Is there a way for mouse signals to be propagated or is this a limitation in Qt... in which case is there a workaround? – Paul Masri-Stone Jan 28 '16 at 13:49
  • Have you tried to put mouse area on top? – Kuba hasn't forgotten Monica Jan 28 '16 at 13:50

0 Answers0