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 right: contentHeader.xPosCloseButton
} }
property var clickPos: Qt.point(0, 0) property var clickPos: Qt.point(0, 0)
property bool dragging: false
onPressed: onPressed:
{ {
clickPos = Qt.point(mouse.x, mouse.y); clickPos = Qt.point(mouse.x, mouse.y);
dragging = true
} }
onPositionChanged: onPositionChanged:
{ {
var delta = Qt.point(mouse.x - clickPos.x, mouse.y - clickPos.y); if(dragging)
if (delta.x !== 0 || delta.y !== 0)
{ {
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: onDoubleClicked:
{ {
dragging = false
contentContainer.trySetPosition(0, 0); contentContainer.trySetPosition(0, 0);
} }