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

Drag in MouseArea failing if drag.target is not set

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P4: Low
    • None
    • 5.8.0, 5.9.0 Beta 1, 5.10
    • None

    Description

      Drag events are generated erratically and often conflict with pressed events, eventually leading to stalling the input system, if a MouseArea does not have a drag.target set.

      Things seem to work as expected in 5.6 though.

      to reproduce:

      // main.qml
      import QtQuick 2.8
      import QtQuick.Window 2.2
       
      Window {
          width: 360
          height: 360
          visible: true
       
          MouseArea {
              id: ma
              anchors.fill: parent
       
              //Item { id: dummy }
              //drag.target: dummy
       
              drag.target: ma // needs a target! dummy target works too
       
              onClicked: console.log("ma clicked")
       
              Rectangle {
                  color: ma.pressed ? "red" : "yellow"
                  width: parent.width / 2
                  height: parent.height / 2
                  anchors.centerIn: parent
       
                  Text {
                      text: "MouseArea::pressed: " + ma.pressed
                          + "\nDrag.active: " + parent.Drag.active
                      anchors.centerIn: parent
                  }
       
                  Drag.active: ma.drag.active
                  Drag.dragType: Drag.Automatic
       
                  Drag.onActiveChanged: console.log("active", active)
                  Drag.onDragStarted: {
                      console.log("rect drag started", Drag.imageSource)
                  }
                  Drag.onDragFinished: console.log("rect drag finished")
              }
          }
      }
      

      Attachments

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

        Activity

          People

            srutledg Shawn Rutledge
            paangele Paolo Angelelli
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes