fix(taskManager):解决初次加载图标重叠和icon报错问题

This commit is contained in:
qiqi49 2024-06-12 14:51:55 +08:00 committed by iaom
parent 3de43b9127
commit 1113862c6d
2 changed files with 26 additions and 9 deletions

View File

@ -145,10 +145,4 @@ WidgetItem {
}
}
}
Component.onCompleted: {
// init
if (Widget.globalConfig.mergeIcons === undefined) {
Widget.globalConfig.mergeIcons = 0;
}
}
}

View File

@ -102,13 +102,14 @@ DropArea {
property bool useSingleItem: taskItemView.isMergeStatus || (CurrentWinIdList ? CurrentWinIdList.length < 1 : true)
// winId
property var singleWinId: []
property bool iconNeedsUpdate: true
width: taskItemView.isHorizontal ? taskItemLoader.width : taskItemView.width
height: taskItemView.isHorizontal ? taskItemView.height : taskItemLoader.height
visible: DelegateModel.inItems || !isDragStatus
onIconChanged: {
generateDragImage();
iconNeedsUpdate = true;
}
function generateDragImage() {
@ -195,7 +196,12 @@ DropArea {
}
//
// onPressed: parent.generateDragImage();
onPressed: {
if (iconNeedsUpdate) {
parent.generateDragImage();
iconNeedsUpdate = false;
}
}
drag.target: mouseArea
drag.onActiveChanged: {
taskItemListRoot.requestThumbnailView(false, null);
@ -400,7 +406,11 @@ DropArea {
// contentWidth: childrenRect.width
// width: childrenRect.width
// height: parent.height
property bool isMergeStatus: (Widget.globalConfig.mergeIcons === 0)
property bool isMergeStatus: {
var status = Widget.globalConfig.mergeIcons;
return (status === undefined) || (status === 0) ;
}
property bool isHorizontal: orientation === ListView.Horizontal
property real taskItemSize: isHorizontal ? taskItemView.height : taskItemView.width
clip: true
@ -426,6 +436,19 @@ DropArea {
updateIconGeometryTimer.restart();
}
function updateIconState() {
for (let i = 0; i < taskItemDelegateModel.count; ++i) {
taskItemView.itemAtIndex(i).iconNeedsUpdate = true;
}
}
Component.onCompleted: {
Platform.Theme.iconThemeChanged.connect(updateIconState);
if (Widget.globalConfig.mergeIcons === undefined) {
Widget.globalConfig.mergeIcons = 0;
}
}
Timer {
id: updateIconGeometryTimer
interval: 500