Workaround for continued xChanged after window was hid.

This commit is contained in:
Hannah von Reth 2015-09-28 12:00:52 +02:00
parent f143a9aced
commit 57f117da29
1 changed files with 17 additions and 9 deletions

View File

@ -6,6 +6,9 @@ Rectangle {
property int snoreBaseSize: body.font.pixelSize
Drag.active: mouseAreaAccept.drag.active
width: snoreBaseSize * 30
height: snoreBaseSize * 9
color: window.color
@ -23,17 +26,23 @@ Rectangle {
onXChanged: {
window.x += x
var visibleWidth = window.isOrientatedLeft?
window.x - window.animationTo:
window.x - window.animationFrom
if(window.visible && Math.abs(visibleWidth + mouseAreaAccept.mouseX) <= width * 0.05){
window.visible = false
window.dismissed()
// There is a Qt bug which will not stop the mouse tracking if the
// item is hid during a drag event.
if(Drag.active){
window.x += x
if(window.visible && Math.abs((window.isOrientatedLeft?
window.x - window.animationTo:
window.x - window.animationFrom) + mouseAreaAccept.mouseX) <= width * 0.05){
Drag.cancel()
window.visible = false
window.dismissed()
}
} else {
x = 0
}
}
NumberAnimation{
id: animation
properties: "x"
@ -48,7 +57,6 @@ Rectangle {
anchors.fill: parent
z: 90
onClicked: {
console.log("invoked")
window.invoked()
}
drag.target: parent