From c7ace5e407e71d781adcbb884b375c273eab3bec Mon Sep 17 00:00:00 2001 From: Michael Bohlender Date: Fri, 2 Mar 2018 16:43:19 +0100 Subject: initial drag without drop for events --- views/calendar/qml/View.qml | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/views/calendar/qml/View.qml b/views/calendar/qml/View.qml index 0d86313d..213023b6 100644 --- a/views/calendar/qml/View.qml +++ b/views/calendar/qml/View.qml @@ -193,11 +193,26 @@ FocusScope { delegate: Rectangle { id: eventDelegate + + states: [ + State { + name: "dnd" + when: mouseArea.drag.active + + PropertyChanges {target: mouseArea; cursorShape: Qt.ClosedHandCursor} + PropertyChanges {target: eventDelegate; x: x; y: y} + PropertyChanges {target: eventDelegate; parent: root} + PropertyChanges {target: eventDelegate; opacity: 0.7} + PropertyChanges {target: eventDelegate; anchors.right: ""} + PropertyChanges {target: eventDelegate; width: Kube.Units.gridUnit * 7 - Kube.Units.smallSpacing * 2} + } + ] + anchors { right: parent.right rightMargin: Kube.Units.smallSpacing } - width: parent.width - Kube.Units.smallSpacing * 2 - Kube.Units.gridUnit * model.indention + width: Kube.Units.gridUnit * 7 - Kube.Units.smallSpacing * 2 - Kube.Units.gridUnit * model.indention height: Kube.Units.gridUnit * model.duration y: Kube.Units.gridUnit * model.starts x: Kube.Units.gridUnit * model.indention @@ -215,10 +230,17 @@ FocusScope { color: Kube.Colors.highlightedTextColor } + Drag.active: mouseArea.drag.active + Drag.hotSpot.x: mouseArea.mouseX + Drag.hotSpot.y: mouseArea.mouseY + Drag.source: eventDelegate + MouseArea { + id: mouseArea anchors.fill: parent hoverEnabled: true + drag.target: parent onEntered: { eventDelegate.z = eventDelegate.z + 100 -- cgit v1.2.3