From 8d7dadd90f5afbffd4adea0c9122186ef1e15db4 Mon Sep 17 00:00:00 2001 From: Tian Shilin Date: Mon, 9 Mar 2026 16:51:38 +0800 Subject: [PATCH] fix: Optimized tray window icon sorting log: TraySortOrderModel::registerToSection() used prepend() to insert newly registered tray items at the beginning of the list, causing tray icons to display in launch order rather than saved order after application restart. Changed prepend() to append(), adding newly registered tray items to the end of the list. This preserves the positional order of existing items, ensuring tray icons display in their last-saved positions. pms: bug-299965 --- panels/dock/tray/traysortordermodel.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/panels/dock/tray/traysortordermodel.cpp b/panels/dock/tray/traysortordermodel.cpp index 805bd1ce9..c66677ac2 100644 --- a/panels/dock/tray/traysortordermodel.cpp +++ b/panels/dock/tray/traysortordermodel.cpp @@ -329,7 +329,9 @@ void TraySortOrderModel::registerToSection(const QString & surfaceId, const QStr } if (!section->contains(surfaceId)) { - section->prepend(surfaceId); + // 新项添加到末尾,保持已有项的位置顺序 + // 这样可以确保应用重启后,托盘图标按上次保存的顺序显示 + section->append(surfaceId); } }