DoubleClick and drag no longer contradict eachother for expandable component

CURA-6478
This commit is contained in:
Jaime van Kessel 2019-04-29 15:13:01 +02:00
parent 19cd8f4edc
commit 56c0cae71f

View file

@ -268,23 +268,32 @@ Item
right: contentHeader.xPosCloseButton
}
property var clickPos: Qt.point(0, 0)
property bool dragging: false
onPressed:
{
clickPos = Qt.point(mouse.x, mouse.y);
dragging = true
}
onPositionChanged:
{
var delta = Qt.point(mouse.x - clickPos.x, mouse.y - clickPos.y);
if (delta.x !== 0 || delta.y !== 0)
if(dragging)
{
contentContainer.trySetPosition(contentContainer.x + delta.x, contentContainer.y + delta.y);
var delta = Qt.point(mouse.x - clickPos.x, mouse.y - clickPos.y);
if (delta.x !== 0 || delta.y !== 0)
{
contentContainer.trySetPosition(contentContainer.x + delta.x, contentContainer.y + delta.y);
}
}
}
onReleased:
{
dragging = false
}
onDoubleClicked:
{
dragging = false
contentContainer.trySetPosition(0, 0);
}