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

TapHandler and DragHandler are broken inside Control

    XMLWordPrintable

Details

    • Linux/X11

    Description

      When inside a Control, TapHandler will detect press and release but will not emit any tap related event.

      The DragHandler will detect a drag but active leep oscillating between true and false.

      Sample code:

      import QtQml
      import QtQuick
      import QtQuick.Controls
      import QtQuick.Layouts
      
      Control {
          height: 40
          background: Rectangle {
              color: 'red'
          }
      
          contentItem: RowLayout {
              height: 40
              spacing: 50
      
              Control {
                  id: control
                  height:40
                  implicitWidth: 50
                  Layout.fillWidth: true
                  Layout.fillHeight: true
                  contentItem: Item {}
                  background: Rectangle { color: 'blue' }
                  color: 'yellow'
      
                  TapHandler {
                      acceptedButtons: Qt.LeftButton
                      onSingleTapped: (eventPoint) => { console.log('single tapped left'); }
                      onTapped: (eventPoint) => { console.log('tapped left'); }
                      onPressedChanged: console.log("pressed left " + pressed + tapCount)
                  }
      
                  DragHandler {
                      onActiveChanged: console.log("drag active: " + active)
                      target: null
                  }
              }
      
              Label {
                  id: label
                  width: 100
                  Layout.fillWidth: true
                  Layout.fillHeight: true
                  text: "bar"
                  background: Rectangle { color: 'green' }
      
                  TapHandler {
                      acceptedButtons: Qt.LeftButton
                      onSingleTapped: (eventPoint) => { console.log('single tapped left'); }
                      onTapped: (eventPoint) => { console.log('tapped left'); }
                      onPressedChanged: console.log("pressed left " + pressed + tapCount)
                  }
      
                  DragHandler {
                      onActiveChanged: console.log("drag active: " + active)
                      target: null
                  }
              }
      
          }
      }
      

      Expected bahviour

      When interecting with label we have the expected behaviour.
      When clicking the logs are:

      qml: pressed left true0
      qml: tapped left
      qml: single tapped left
      qml: pressed left false1
      

      When dragging on the label the logs are:

      qml: pressed left true1
      qml: drag active: true
      qml: pressed left false1
      qml: drag active: false
      

      Observed behaviour

      However, on control we have, for a click:

      qml: pressed left true0
      qml: pressed left false0
      

      The tap signals are not emitted.

      for a drag:

      qml: pressed left true0
      qml: drag active: true
      qml: pressed left false0
      qml: drag active: false
      qml: drag active: true
      qml: drag active: false
      qml: drag active: true
      qml: drag active: false
      qml: drag active: true
      qml: drag active: false
      qml: drag active: true
      qml: drag active: false
      qml: drag active: true
      qml: drag active: false
      qml: drag active: true
      qml: drag active: false
      qml: drag active: true
      qml: drag active: false
      

      The drag "restarts".

      Attachments

        Issue Links

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

          Activity

            People

              qt.team.quick.subscriptions Qt Quick and Widgets Team
              bterrier Benjamin Terrier
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes