af9aeecc.patch 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. From af9aeeccfa2a6efb16e4c5904768c55f97c022ff Mon Sep 17 00:00:00 2001
  2. From: Noah Davis <noahadvs@gmail.com>
  3. Date: Wed, 20 Oct 2021 23:24:15 -0400
  4. Subject: [PATCH] kickoff: Fix drag and drop causing delegates to reset to a 0
  5. X position and overlap
  6. BUG: 443975
  7. (cherry picked from commit 70860fe8649b56b18301c90bc3c87b9406cc515d)
  8. ---
  9. .../package/contents/ui/KickoffGridView.qml | 2 +-
  10. .../contents/ui/KickoffItemDelegate.qml | 19 +++----------------
  11. .../package/contents/ui/KickoffListView.qml | 2 +-
  12. 3 files changed, 5 insertions(+), 18 deletions(-)
  13. diff --git a/applets/kickoff/package/contents/ui/KickoffGridView.qml b/applets/kickoff/package/contents/ui/KickoffGridView.qml
  14. index 269469d66..4367fabf2 100644
  15. --- a/applets/kickoff/package/contents/ui/KickoffGridView.qml
  16. +++ b/applets/kickoff/package/contents/ui/KickoffGridView.qml
  17. @@ -115,7 +115,7 @@ EmptyPage {
  18. highlight: PlasmaCore.FrameSvgItem {
  19. // The default Z value for delegates is 1. The default Z value for the section delegate is 2.
  20. // The highlight gets a value of 3 while the drag is active and then goes back to the default value of 0.
  21. - z: root.currentItem && root.currentItem.dragActive ?
  22. + z: root.currentItem && root.currentItem.Drag.active ?
  23. 3 : 0
  24. opacity: view.activeFocus
  25. || (KickoffSingleton.contentArea === root
  26. diff --git a/applets/kickoff/package/contents/ui/KickoffItemDelegate.qml b/applets/kickoff/package/contents/ui/KickoffItemDelegate.qml
  27. index e249108fa..1353f5946 100644
  28. --- a/applets/kickoff/package/contents/ui/KickoffItemDelegate.qml
  29. +++ b/applets/kickoff/package/contents/ui/KickoffItemDelegate.qml
  30. @@ -49,9 +49,6 @@ T.ItemDelegate {
  31. property bool isSearchResult: false
  32. readonly property bool menuClosed: ActionMenu.menu.status == 3 // corresponds to DialogStatus.Closed
  33. - property point dragStartPosition: Qt.point(x,y)
  34. - property int dragStartIndex: index
  35. - readonly property alias dragActive: mouseArea.drag.active
  36. property bool dragEnabled: enabled && !root.isCategory && !root.view.interactive
  37. && plasmoid.immutability !== PlasmaCore.Types.SystemImmutable
  38. @@ -84,7 +81,7 @@ T.ItemDelegate {
  39. // The default Z value for delegates is 1. The default Z value for the section delegate is 2.
  40. // The highlight gets a value of 3 while the drag is active and then goes back to the default value of 0.
  41. - z: dragActive ? 4 : 1
  42. + z: Drag.active ? 4 : 1
  43. implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
  44. implicitContentWidth + leftPadding + rightPadding)
  45. @@ -202,12 +199,9 @@ T.ItemDelegate {
  46. acceptedButtons: Qt.LeftButton | Qt.RightButton
  47. drag {
  48. axis: Drag.XAndYAxis
  49. - target: root.dragEnabled ? root : undefined
  50. - minimumX: 0
  51. - maximumX: root.view ? Math.min(root.view.contentWidth - root.width, root.view.availableWidth - root.width) : root.x
  52. - minimumY: 0
  53. - maximumY: root.view ? Math.min(root.view.contentHeight - root.height, root.view.availableHeight - root.height) : root.y
  54. + target: root.dragEnabled ? dragItem : undefined
  55. }
  56. + Item { id: dragItem }
  57. // Using onPositionChanged instead of onEntered to prevent changing
  58. // categories while scrolling with the mouse wheel.
  59. onPositionChanged: {
  60. @@ -279,11 +273,4 @@ T.ItemDelegate {
  61. indicator = null
  62. }
  63. }
  64. - onDragActiveChanged: if (dragActive) {
  65. - dragStartPosition = Qt.point(x,y)
  66. - dragStartIndex = index
  67. - } else if (dragStartIndex === index) {
  68. - x = dragStartPosition.x
  69. - y = dragStartPosition.y
  70. - }
  71. }
  72. diff --git a/applets/kickoff/package/contents/ui/KickoffListView.qml b/applets/kickoff/package/contents/ui/KickoffListView.qml
  73. index 9dffafb41..9a0c3c233 100644
  74. --- a/applets/kickoff/package/contents/ui/KickoffListView.qml
  75. +++ b/applets/kickoff/package/contents/ui/KickoffListView.qml
  76. @@ -117,7 +117,7 @@ EmptyPage {
  77. highlight: PlasmaCore.FrameSvgItem {
  78. // The default Z value for delegates is 1. The default Z value for the section delegate is 2.
  79. // The highlight gets a value of 3 while the drag is active and then goes back to the default value of 0.
  80. - z: root.currentItem && root.currentItem.dragActive ?
  81. + z: root.currentItem && root.currentItem.Drag.active ?
  82. 3 : 0
  83. opacity: view.activeFocus
  84. || (KickoffSingleton.contentArea === root
  85. --
  86. GitLab