Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-55688

PinchArea can break MouseArea::pressed

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4: Low P4: Low
    • None
    • 5.5.0
    • None

      Given the following example:

      import QtQuick 2.5
      
      Item {
              PinchArea {
                      id: pa
                      anchors.top: parent.top
                      width: parent.width
                      height: parent.height / 2
      
                      Rectangle {
                              anchors.fill: parent
                              color: "red"
                      }
              }
      
              MouseArea {
                      id: ma
                      anchors.top: pa.bottom
                      width: parent.width
                      height: parent.height / 2
      
                      Rectangle {
                              color: ma.pressed ? "red" : "blue"
                              anchors.fill: parent
                      }
              }
      }
      

      Place two fingers on the top half of the screen, and begin pinching. Then tap the bottom MouseArea.

      Observe that the MouseArea turns red, but never turns back to blue until tapped again after the PinchArea is released.

      I conjecture that this is due to PinchArea needing to handle pretty much any QTouchEvent that hits it in order to grab its own events, but it seems rather disconcerting and bad that it also ends up sending MouseArea into an inconsistent state.

      I'm not sure if there's an easy solution here on the old item types. In theory, PinchArea could explicitly accept the QTouchEvent once it has begun pinching (to avoid bleeding the event on to MouseArea), avoiding pressed becoming true to begin with, but this may have unforseen consequences...

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            srutledg Shawn Rutledge
            w00t Robin Burchell
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes