Skip to content

Commit 9dd0aa5

Browse files
committed
Disable DropArea for our own drags
It doesn't make sense to drag our own items back into the app itself in sink mode and it only creates a confusing animation, when starting to drag items. The animation is still enabled when dropping. It is a shame that direct QML bindings do not work inside into another ListView. An example of the confusing animation can be seen as an unrelated sideeffect in the demo of #5.
1 parent dea22dd commit 9dd0aa5

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

src/qml/Main.qml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ ApplicationWindow {
2525
onActivated: Qt.quit();
2626
}
2727
DropArea {
28+
enabled: !pathView.dragActive
2829
onDropped: (drop) => {
2930
Backend.handle_dropped_urls(drop.urls);
3031
}

src/qml/PathView.qml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import Backend
55

66
ListView {
77
id: pathView
8+
property bool dragActive: false
9+
810
model: PathModel
911
visible: count
1012
spacing: 6
@@ -33,10 +35,14 @@ ListView {
3335
onPreDragStarted: {
3436
PathModel.refresh_folded_paths();
3537
}
36-
onDragStarted: Settings.alwaysOnBottom = true
38+
onDragStarted: {
39+
Settings.alwaysOnBottom = true;
40+
pathView.dragActive = true;
41+
}
3742
onDragFinished: (dropAction) => {
3843
PathModel.taint_all_used();
3944
Settings.alwaysOnBottom = false;
45+
pathview.dragActive = false;
4046
}
4147
}
4248
}
@@ -98,10 +104,14 @@ ListView {
98104
hoverEnabled: true
99105
acceptedButtons: Qt.LeftButton | Qt.RightButton
100106
onClicked: PathModel.open(index);
101-
onDragStarted: Settings.alwaysOnBottom = true
107+
onDragStarted: {
108+
Settings.alwaysOnBottom = true;
109+
pathView.dragActive = true;
110+
}
102111
onDragFinished: (dropAction) => {
103112
PathModel.taint_used(index)
104113
Settings.alwaysOnBottom = false;
114+
pathView.dragActive = false;
105115
}
106116
}
107117
}

0 commit comments

Comments
 (0)