Skip to content
Merged
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
7 changes: 7 additions & 0 deletions panels/notification/center/NotifyView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ Control {
snapMode: ListView.SnapToItem
// activeFocusOnTab: true
ScrollBar.vertical: ScrollBar { }
property int nextIndex: -1

onNextIndexChanged: {
if (nextIndex >= 0 && count > 0) {
currentIndex = nextIndex
}
}

model: root.notifyModel
delegate: NotifyViewDelegate {
Expand Down
8 changes: 7 additions & 1 deletion panels/notification/center/NotifyViewDelegate.qml
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,15 @@ DelegateChooser {
}
onRemove: function () {
console.log("remove normal", model.id)
let removeIndex = index
notifyModel.remove(model.id)
root.view.nextIndex = Math.min(removeIndex, root.view.count - 1)
}
onDismiss: function () {
console.log("dismiss normal", model.id)
let dismissIndex = index
notifyModel.remove(model.id)
root.view.nextIndex = Math.min(dismissIndex, root.view.count - 1)
}
onActionInvoked: function (actionId) {
console.log("action normal", model.id, actionId)
Expand Down Expand Up @@ -163,7 +167,9 @@ DelegateChooser {
onExpand: function ()
{
console.log("expand")
notifyModel.expandApp(model.index)
let expandIndex = model.index
Copy link
Contributor

Choose a reason for hiding this comment

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

这个需不需要弄一个全局nextIndex的呀,我看展开,折叠,删除,都可能会需要currentIndex指向正确的index,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

似乎不需要,他折叠和删除,默认listview的焦点行为会给到下一个,焦点不会乱跳

Copy link
Contributor

Choose a reason for hiding this comment

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

会乱跑吧,你删除一个中间的试试,

notifyModel.expandApp(expandIndex)
root.view.nextIndex = expandIndex + 1
}
onSetting: function (pos) {
let tmp = mapToItem(root.view, pos)
Expand Down