Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions panels/notification/center/notifymodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ void NotifyModel::expandApp(int row)
}
endInsertRows();
}

// Rebuild all delegates to ensure Tab focus order matches visual order
rebuildDelegates();
}

void NotifyModel::collapseApp(int row)
Expand Down Expand Up @@ -129,6 +132,9 @@ void NotifyModel::collapseApp(int row)
m_appNotifies.insert(row, overlap);
endInsertRows();
}

// Rebuild all delegates to ensure Tab focus order matches visual order
rebuildDelegates();
}

void NotifyModel::close()
Expand Down Expand Up @@ -361,6 +367,14 @@ void NotifyModel::sortNotifies()
sort(0, Qt::DescendingOrder);
}

void NotifyModel::rebuildDelegates()
{
// Force a model reset so that QML ListView delegates are destroyed and recreated
// in the current order, which helps synchronize Tab focus order with visual order.
beginResetModel();
Copy link
Contributor

@18202781743 18202781743 Nov 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个这样直接reset,可能会影响动画的,
为什么要让它重新生成呀,之前的代码是特意不让它重新生成的,焦点问题是不是可以按照当前应该的index,主动在界面上用listview的接口设置,让它特定的Item获得焦点,类似这样https://github.com/linuxdeepin/dde-shell/blob/master/panels/notification/center/NotifyView.qml#L32

endResetModel();
}

void NotifyModel::trayUpdateGroupLastEntity(const NotifyEntity &entity)
{
if (const auto index = firstNotifyIndex(entity.appName(), NotifyType::Group); index >= 0) {
Expand Down
1 change: 1 addition & 0 deletions panels/notification/center/notifymodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ private slots:
void trayUpdateGroupLastEntity(const QString &appName);
void updateCollapseStatus();
void updateContentRowCount(int rowCount);
void rebuildDelegates();

private:
QList<AppNotifyItem *> m_appNotifies;
Expand Down