From 57f117da296eb3387f3c2abb5624723e7eacf0f2 Mon Sep 17 00:00:00 2001 From: Hannah von Reth Date: Mon, 28 Sep 2015 12:00:52 +0200 Subject: [PATCH] Workaround for continued xChanged after window was hid. --- src/plugins/backends/snore/notification.qml | 26 ++++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/src/plugins/backends/snore/notification.qml b/src/plugins/backends/snore/notification.qml index 2c100a3..438dedd 100644 --- a/src/plugins/backends/snore/notification.qml +++ b/src/plugins/backends/snore/notification.qml @@ -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