-
Notifications
You must be signed in to change notification settings - Fork 55
fix: icons stuck together caused by listview add animation #1367
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -14,32 +14,17 @@ ContainmentItem { | |||||||||||||||
| property bool useColumnLayout: Panel.position % 2 | ||||||||||||||||
| property int dockOrder: 16 | ||||||||||||||||
| property int remainingSpacesForTaskManager: Panel.itemAlignment === Dock.LeftAlignment ? Panel.rootObject.dockLeftSpaceForCenter : Panel.rootObject.dockRemainingSpaceForCenter | ||||||||||||||||
| property int forceRelayoutWorkaround: 0 | ||||||||||||||||
|
|
||||||||||||||||
| property int remainingSpacesForSplitWindow: Panel.rootObject.dockLeftSpaceForCenter - (Panel.rootObject.dockCenterPartCount - 1) * Panel.rootObject.dockItemMaxSize * 9 / 14 | ||||||||||||||||
| // 用于居中计算的实际应用区域尺寸 | ||||||||||||||||
| property int appContainerWidth: useColumnLayout ? Panel.rootObject.dockSize : (appContainer.implicitWidth + forceRelayoutWorkaround) | ||||||||||||||||
| property int appContainerHeight: useColumnLayout ? (appContainer.implicitHeight + forceRelayoutWorkaround) : Panel.rootObject.dockSize | ||||||||||||||||
| property int appContainerWidth: useColumnLayout ? Panel.rootObject.dockSize : appContainer.implicitWidth | ||||||||||||||||
| property int appContainerHeight: useColumnLayout ? appContainer.implicitHeight : Panel.rootObject.dockSize | ||||||||||||||||
|
|
||||||||||||||||
| // 动态字符限制数组,存储每个应用的最大显示字符数 | ||||||||||||||||
| property var dynamicCharLimits: [] | ||||||||||||||||
|
|
||||||||||||||||
| Timer { | ||||||||||||||||
| // FIXME: dockItemMaxSize(visualModel.cellWidth,actually its implicitWidth/Height) change will cause all delegate item's position change, but | ||||||||||||||||
| // the newly added item will using the old cellWidth to calculate its position, thus it will be placed in the wrong position. Also it | ||||||||||||||||
| // seems forceLayout() simply doesn't work, so we use a workaround here to force relayout the ListView inside the OverflowContainer. | ||||||||||||||||
| // See: QTBUG-133953 | ||||||||||||||||
| id: relayoutWorkaroundTimer | ||||||||||||||||
| interval: 250 // should longer than OverflowContainer.add duration | ||||||||||||||||
| repeat: false | ||||||||||||||||
| onTriggered: { | ||||||||||||||||
| taskmanager.forceRelayoutWorkaround = visualModel.count % 2 + 1 | ||||||||||||||||
| console.log("force relayout", taskmanager.forceRelayoutWorkaround) | ||||||||||||||||
| } | ||||||||||||||||
| } | ||||||||||||||||
|
|
||||||||||||||||
| implicitWidth: useColumnLayout ? Panel.rootObject.dockSize : (Math.max(remainingSpacesForTaskManager, appContainer.implicitWidth) + forceRelayoutWorkaround) | ||||||||||||||||
| implicitHeight: useColumnLayout ? (Math.max(remainingSpacesForTaskManager, appContainer.implicitHeight) + forceRelayoutWorkaround) : Panel.rootObject.dockSize | ||||||||||||||||
| implicitWidth: useColumnLayout ? Panel.rootObject.dockSize : Math.max(remainingSpacesForTaskManager, appContainer.implicitWidth) | ||||||||||||||||
| implicitHeight: useColumnLayout ? Math.max(remainingSpacesForTaskManager, appContainer.implicitHeight) : Panel.rootObject.dockSize | ||||||||||||||||
|
|
||||||||||||||||
| // Helper function to find the current index of an app by its appId in the visualModel | ||||||||||||||||
| function findAppIndex(appId) { | ||||||||||||||||
|
|
@@ -238,14 +223,6 @@ ContainmentItem { | |||||||||||||||
| anchors.fill: parent | ||||||||||||||||
| useColumnLayout: taskmanager.useColumnLayout | ||||||||||||||||
| spacing: Panel.rootObject.itemSpacing + visualModel.count % 2 | ||||||||||||||||
| add: Transition { | ||||||||||||||||
| NumberAnimation { | ||||||||||||||||
| properties: "scale,opacity" | ||||||||||||||||
| from: 0 | ||||||||||||||||
| to: 1 | ||||||||||||||||
| duration: 200 | ||||||||||||||||
| } | ||||||||||||||||
| } | ||||||||||||||||
| remove: Transition { | ||||||||||||||||
| NumberAnimation { | ||||||||||||||||
| properties: "scale,opacity" | ||||||||||||||||
|
|
@@ -277,7 +254,6 @@ ContainmentItem { | |||||||||||||||
| // 1:4 the distance between app : dock height; get width/height≈0.8 | ||||||||||||||||
| property real cellWidth: Panel.rootObject.dockItemMaxSize * 0.8 | ||||||||||||||||
| onCountChanged: function() { | ||||||||||||||||
| relayoutWorkaroundTimer.start() | ||||||||||||||||
| DS.singleShot(300, updateDynamicCharLimits) | ||||||||||||||||
| } | ||||||||||||||||
| delegate: Item { | ||||||||||||||||
|
|
@@ -312,6 +288,14 @@ ContainmentItem { | |||||||||||||||
| return false | ||||||||||||||||
| } | ||||||||||||||||
|
|
||||||||||||||||
| ListView.onAdd: NumberAnimation { | ||||||||||||||||
| target: delegateRoot | ||||||||||||||||
| properties: "scale,opacity" | ||||||||||||||||
| from: 0 | ||||||||||||||||
| to: 1 | ||||||||||||||||
| duration: 200 | ||||||||||||||||
| } | ||||||||||||||||
|
|
||||||||||||||||
|
Comment on lines
+291
to
+298
|
||||||||||||||||
| ListView.onAdd: NumberAnimation { | |
| target: delegateRoot | |
| properties: "scale,opacity" | |
| from: 0 | |
| to: 1 | |
| duration: 200 | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add是附加属性的信号,这里是响应信号的槽函数么,这样写是什么意思呀?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
就是在 onAdd 信号触发的时候触发动画。
(p.s. 这是 QTBUG-133953 里给我的建议修改方式)