Child control cannot receive drag and drop messages
Unsolved
QML and Qt Quick
-
When both the parent control and the child control can receive drag and drop messages, if drag and drop first enters the child control from the parent control, then the child control will not receive the drag and drop message and will still be on the parent control. How can I solve this problem?
import QtQuick 2.9 import QtQuick.Window 2.2 Window { visible: true width: 640 height: 480 title: qsTr("Hello World") Rectangle{ id:first width:100 height:100 color:"red" z:0 MouseArea{ anchors.fill: parent DropArea{ anchors.fill: parent id:dragTarget Rectangle { id: dropRectangle anchors.fill: parent color: "transparent" states: [ State { when: dragTarget.containsDrag PropertyChanges { target: dropRectangle color: "grey" } } ] } onDropped: { console.log('onDropped----1') } } } Rectangle{ id:second width:50 height:50 color:"blue" z:1 MouseArea{ anchors.fill:parent DropArea{ anchors.fill: parent id:dragTarget2 Rectangle { id: dropRectangle2 anchors.fill: parent color: "transparent" states: [ State { when: dragTarget2.containsDrag PropertyChanges { target: dropRectangle2 color: "green" } } ] } onDropped: { console.log('onDropped----2') } } } } } }