HDrawer resizer: use MouseArea's pressed prop

This commit is contained in:
miruka 2019-12-10 14:23:14 -04:00
parent 0578844eef
commit 8c8ba221d3

View File

@ -87,24 +87,21 @@ Drawer {
(horizontal ? Qt.SizeHorCursor : Qt.SizeVerCursor) :
Qt.ArrowCursor
onPressed: canResize = true
onReleased: {canResize = false; userResized(drawer.preferredSize)}
onMouseXChanged:
if (horizontal && canResize) {
if (horizontal && pressed) {
drawer.preferredSize =
drawer.calculatedSize +
(drawer.edge === Qt.RightEdge ? -mouseX : mouseX)
}
onMouseYChanged:
if (vertical && canResize) {
if (vertical && pressed) {
drawer.preferredSize =
drawer.calculatedSize +
(drawer.edge === Qt.BottomEdge ? -mouseY : mouseY)
}
property bool canResize: false
onReleased: userResized(drawer.preferredSize)
}
}
}