Files
2021-10-27 20:39:53 +03:00

96 lines
4.6 KiB
Diff

From af9aeeccfa2a6efb16e4c5904768c55f97c022ff Mon Sep 17 00:00:00 2001
From: Noah Davis <noahadvs@gmail.com>
Date: Wed, 20 Oct 2021 23:24:15 -0400
Subject: [PATCH] kickoff: Fix drag and drop causing delegates to reset to a 0
X position and overlap
BUG: 443975
(cherry picked from commit 70860fe8649b56b18301c90bc3c87b9406cc515d)
---
.../package/contents/ui/KickoffGridView.qml | 2 +-
.../contents/ui/KickoffItemDelegate.qml | 19 +++----------------
.../package/contents/ui/KickoffListView.qml | 2 +-
3 files changed, 5 insertions(+), 18 deletions(-)
diff --git a/applets/kickoff/package/contents/ui/KickoffGridView.qml b/applets/kickoff/package/contents/ui/KickoffGridView.qml
index 269469d66..4367fabf2 100644
--- a/applets/kickoff/package/contents/ui/KickoffGridView.qml
+++ b/applets/kickoff/package/contents/ui/KickoffGridView.qml
@@ -115,7 +115,7 @@ EmptyPage {
highlight: PlasmaCore.FrameSvgItem {
// The default Z value for delegates is 1. The default Z value for the section delegate is 2.
// The highlight gets a value of 3 while the drag is active and then goes back to the default value of 0.
- z: root.currentItem && root.currentItem.dragActive ?
+ z: root.currentItem && root.currentItem.Drag.active ?
3 : 0
opacity: view.activeFocus
|| (KickoffSingleton.contentArea === root
diff --git a/applets/kickoff/package/contents/ui/KickoffItemDelegate.qml b/applets/kickoff/package/contents/ui/KickoffItemDelegate.qml
index e249108fa..1353f5946 100644
--- a/applets/kickoff/package/contents/ui/KickoffItemDelegate.qml
+++ b/applets/kickoff/package/contents/ui/KickoffItemDelegate.qml
@@ -49,9 +49,6 @@ T.ItemDelegate {
property bool isSearchResult: false
readonly property bool menuClosed: ActionMenu.menu.status == 3 // corresponds to DialogStatus.Closed
- property point dragStartPosition: Qt.point(x,y)
- property int dragStartIndex: index
- readonly property alias dragActive: mouseArea.drag.active
property bool dragEnabled: enabled && !root.isCategory && !root.view.interactive
&& plasmoid.immutability !== PlasmaCore.Types.SystemImmutable
@@ -84,7 +81,7 @@ T.ItemDelegate {
// The default Z value for delegates is 1. The default Z value for the section delegate is 2.
// The highlight gets a value of 3 while the drag is active and then goes back to the default value of 0.
- z: dragActive ? 4 : 1
+ z: Drag.active ? 4 : 1
implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
implicitContentWidth + leftPadding + rightPadding)
@@ -202,12 +199,9 @@ T.ItemDelegate {
acceptedButtons: Qt.LeftButton | Qt.RightButton
drag {
axis: Drag.XAndYAxis
- target: root.dragEnabled ? root : undefined
- minimumX: 0
- maximumX: root.view ? Math.min(root.view.contentWidth - root.width, root.view.availableWidth - root.width) : root.x
- minimumY: 0
- maximumY: root.view ? Math.min(root.view.contentHeight - root.height, root.view.availableHeight - root.height) : root.y
+ target: root.dragEnabled ? dragItem : undefined
}
+ Item { id: dragItem }
// Using onPositionChanged instead of onEntered to prevent changing
// categories while scrolling with the mouse wheel.
onPositionChanged: {
@@ -279,11 +273,4 @@ T.ItemDelegate {
indicator = null
}
}
- onDragActiveChanged: if (dragActive) {
- dragStartPosition = Qt.point(x,y)
- dragStartIndex = index
- } else if (dragStartIndex === index) {
- x = dragStartPosition.x
- y = dragStartPosition.y
- }
}
diff --git a/applets/kickoff/package/contents/ui/KickoffListView.qml b/applets/kickoff/package/contents/ui/KickoffListView.qml
index 9dffafb41..9a0c3c233 100644
--- a/applets/kickoff/package/contents/ui/KickoffListView.qml
+++ b/applets/kickoff/package/contents/ui/KickoffListView.qml
@@ -117,7 +117,7 @@ EmptyPage {
highlight: PlasmaCore.FrameSvgItem {
// The default Z value for delegates is 1. The default Z value for the section delegate is 2.
// The highlight gets a value of 3 while the drag is active and then goes back to the default value of 0.
- z: root.currentItem && root.currentItem.dragActive ?
+ z: root.currentItem && root.currentItem.Drag.active ?
3 : 0
opacity: view.activeFocus
|| (KickoffSingleton.contentArea === root
--
GitLab