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

Nesting a ScrollView into a PinchArea doesn't work as expected

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • None
    • 5.3.0 Beta1
    • Quick: Controls 1
    • None
    • Mac OS 10.9
    • 17643c829d15d43a7d5e2955089595198903775c

    Description

      Take this piece of QML and try to scroll and pinch in different places. Quite often the ScrollView will jump to seemingly random places or the pinch events aren't registered, especially if you touch the rectangles in the top part. The hover events for those rectangles also aren't correctly delivered. See QTBUG-37150 for that.

      import QtQuick 2.0
      import QtQuick.Controls 1.0
      
      Rectangle {
          id: root
          width: 1200
          height: 200
          property real itemWidth: 100
      
          PinchArea {
              anchors.fill: parent
              pinch.minimumScale: 0.1
              pinch.maximumScale: 10
              property real origWidth
              property real origX
      
              onPinchStarted: {
                  origX = flick.contentX;
                  origWidth = root.itemWidth;
              }
      
              onPinchUpdated: {
                  flick.contentX = origX * pinch.scale;
                  root.itemWidth = origWidth * pinch.scale;
              }
      
              onPinchFinished: flick.returnToBounds()
      
              ScrollView {
                  anchors.fill: parent
      
                  Flickable {
                      id: flick
                      contentWidth: row.width
      
                      Row {
                          id: row
                          spacing: 20
                          Repeater {
                              model: 30
                              Rectangle {
                                  width: itemWidth
                                  height: 40
                                  border.width: 1
                                  color: ma.containsMouse ? "red" : "white"
                                  border.color: "black"
                                  antialiasing: true
                                  property int t: index
                                  Text {
                                      anchors.centerIn: parent
                                      text: parent.t
                                  }
      
                                  MouseArea {
                                      id: ma
                                      hoverEnabled: true
                                      anchors.fill: parent
                                      onPositionChanged: console.log(mouse.x, mouse.y)
                                  }
                              }
                          }
                      }
                  }
              }
          }
      }
      

      Also, flicking behaves "jerky" when zooming has been initiated by tapping with two fingers and moving them in certain ways.

      Attachments

        1. simplified.qml
          2 kB
          Shawn Rutledge
        2. test.qml
          2 kB
          Shawn Rutledge

        Issue Links

          For Gerrit Dashboard: QTBUG-37294
          # Subject Branch Project Status CR V

          Activity

            People

              srutledg Shawn Rutledge
              ulherman Ulf Hermann
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes