Forgive my poor English.
I write two samples as following.
Sample1:
import QtQuick 2.0
Item {
width: 200; height: 200
DropArea {
x: 75; y: 75
width: 100; height: 100
Rectangle {
anchors.fill: parent
color: "green"
}
onEntered: console.debug("onEntered")
onExited: console.debug('onExited')
DropArea {
width: 50; height: 50
Rectangle {
anchors.fill: parent
color: "blue"
}
onEntered: console.debug("onEntered 2")
onExited: console.debug('onExited 2')
}
}
Rectangle {
x: 10; y: 10
width: 20; height: 20
color: "red"
Drag.active: dragArea.drag.active
MouseArea {
id: dragArea
anchors.fill: parent
drag.target: parent
}
}
}
Sample2:
import QtQuick 2.0
Item {
width: 200; height: 200
Rectangle {
x: 75; y: 75
width: 100; height: 100
color: "green"
DropArea {
anchors.fill: parent
onEntered: console.debug("onEntered")
onExited: console.debug('onExited')
}
Rectangle {
width: 50; height: 50
color: "blue"
DropArea {
anchors.fill: parent
onEntered: console.debug("onEntered 2")
onExited: console.debug('onExited 2')
}
}
}
Rectangle {
x: 10; y: 10
width: 20; height: 20
color: "red"
Drag.active: dragArea.drag.active
MouseArea {
id: dragArea
anchors.fill: parent
drag.target: parent
}
}
}
You see. The two samples is similiar. But their outputs is different.
You can do as following to test the two samples:
1) Drag the ‘red’ rectangle to ‘blue’ rectangle.
2) Then drag the ‘red’ rectangle to ‘green’ rectangle.
3) Then drag the ‘red’ rectangle back to ‘blue’ rectangle.
4) Finally drag the ‘red’ rectangle back to ‘white’ background.
I use qmlscene to test the two samples in qt5.0.1.
The sample1’s output is:
onEntered
onEntered 2
onExited 2
onEntered 2
onExited 2
onExited
The sample2’s output is:
onEntered 2
onExited 2
onEntered
onExited
So Where is the problem?
↧