Skip to content

Commit 6ea3b2a

Browse files
committed
fix: avoid icon overlap caused by ListView move and displace animation
避免由于 ListView 动画时机问题导致图标相互遮挡的问题. 这个问题是 QTBUG-133953 导致的,官方提供的绕过方案实际不能解决我们场景 所对应的问题(只能解决或者说绕过添加时位置不对的情况). 此修复方式尽可能 规避使用 displaced 动画来对未被移除的图标展示位置变化动画,以使ListView 自身完全不需要关心自身内容的坐标动画(ListView只负责显示被移除元素的消 失动画,即scale缩小并淡出. PMS: BUG-351826, BUG-308927 Log:
1 parent ce1afa5 commit 6ea3b2a

1 file changed

Lines changed: 50 additions & 53 deletions

File tree

panels/dock/taskmanager/package/TaskManager.qml

Lines changed: 50 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,6 @@ ContainmentItem {
6868
remainingSpace: taskmanager.remainingSpacesForSplitWindow
6969
font.family: D.DTK.fontManager.t6.family
7070
font.pixelSize: Math.max(10, Math.min(20, Math.round(textCalculator.iconSize * 0.35)))
71-
onOptimalSingleTextWidthChanged: {
72-
appContainer.addDisplaced = null
73-
appContainer.removeDisplaced = null
74-
Qt.callLater(function() {
75-
appContainer.addDisplaced = addDisplacedTransition
76-
appContainer.removeDisplaced = removeDisplacedTransition
77-
})
78-
}
7971
}
8072

8173
OverflowContainer {
@@ -91,27 +83,6 @@ ContainmentItem {
9183
duration: 200
9284
}
9385
}
94-
moveDisplaced: Transition {
95-
NumberAnimation {
96-
properties: "x,y"
97-
easing.type: Easing.OutQuad
98-
}
99-
}
100-
addDisplaced: Transition {
101-
id: addDisplacedTransition
102-
NumberAnimation {
103-
properties: "x,y"
104-
easing.type: Easing.OutQuad
105-
}
106-
}
107-
removeDisplaced: Transition {
108-
id: removeDisplacedTransition
109-
NumberAnimation {
110-
properties: "x,y"
111-
easing.type: Easing.OutQuad
112-
}
113-
}
114-
move: moveDisplaced
11586
model: DelegateModel {
11687
id: visualModel
11788
model: taskmanager.Applet.dataModel
@@ -168,31 +139,56 @@ ContainmentItem {
168139
property int visualIndex: DelegateModel.itemsIndex
169140
property var modelIndex: visualModel.modelIndex(index)
170141

171-
AppItem {
172-
id: appItem
173-
anchors.fill: parent // This is mandatory for draggable item center in drop area
174-
175-
displayMode: Panel.indicatorStyle
176-
colorTheme: Panel.colorTheme
177-
active: delegateRoot.active
178-
attention: delegateRoot.attention
179-
itemId: delegateRoot.itemId
180-
name: delegateRoot.name
181-
iconName: delegateRoot.iconName
182-
menus: delegateRoot.menus
183-
windows: delegateRoot.windows
184-
visualIndex: delegateRoot.visualIndex
185-
modelIndex: delegateRoot.modelIndex
186-
blendOpacity: taskmanager.blendOpacity
187-
title: delegateRoot.title
188-
enableTitle: textCalculator.enabled
189-
appTitleSpacing: taskmanager.appTitleSpacing
190-
ListView.delayRemove: Drag.active
191-
Component.onCompleted: {
192-
dropFilesOnItem.connect(taskmanager.Applet.dropFilesOnItem)
142+
Rectangle {
143+
// kept for debug purpose
144+
// border.color: "red"
145+
// border.width: 1
146+
color: "transparent"
147+
parent: appContainer
148+
x: delegateRoot.x
149+
y: delegateRoot.y
150+
width: delegateRoot.width
151+
height: delegateRoot.height
152+
scale: delegateRoot.scale
153+
Behavior on x {
154+
NumberAnimation {
155+
duration: 200
156+
easing.type: Easing.OutCubic
157+
}
193158
}
194-
onDragFinished: function() {
195-
launcherDndDropArea.resetDndState()
159+
Behavior on y {
160+
NumberAnimation {
161+
duration: 200
162+
easing.type: Easing.OutCubic
163+
}
164+
}
165+
166+
AppItem {
167+
id: appItem
168+
anchors.fill: parent // This is mandatory for draggable item center in drop area
169+
170+
displayMode: Panel.indicatorStyle
171+
colorTheme: Panel.colorTheme
172+
active: delegateRoot.active
173+
attention: delegateRoot.attention
174+
itemId: delegateRoot.itemId
175+
name: delegateRoot.name
176+
iconName: delegateRoot.iconName
177+
menus: delegateRoot.menus
178+
windows: delegateRoot.windows
179+
visualIndex: delegateRoot.visualIndex
180+
modelIndex: delegateRoot.modelIndex
181+
blendOpacity: taskmanager.blendOpacity
182+
title: delegateRoot.title
183+
enableTitle: textCalculator.enabled
184+
appTitleSpacing: taskmanager.appTitleSpacing
185+
ListView.delayRemove: Drag.active
186+
Component.onCompleted: {
187+
dropFilesOnItem.connect(taskmanager.Applet.dropFilesOnItem)
188+
}
189+
onDragFinished: function() {
190+
launcherDndDropArea.resetDndState()
191+
}
196192
}
197193
}
198194
}
@@ -201,6 +197,7 @@ ContainmentItem {
201197
DropArea {
202198
id: launcherDndDropArea
203199
anchors.fill: parent
200+
z: 3
204201
keys: ["text/x-dde-dock-dnd-appid"]
205202
property string launcherDndDesktopId: ""
206203
property string launcherDndDragSource: ""

0 commit comments

Comments
 (0)