fix scroll position reset when toggling group collapse
This commit is contained in:
parent
69dff5a263
commit
7d5854e340
1 changed files with 12 additions and 2 deletions
|
|
@ -70,15 +70,18 @@ M.HoverPanel {
|
|||
// Collapsed groups set — reassign to trigger reactivity
|
||||
property var _collapsedGroups: ({})
|
||||
|
||||
property real _savedScrollY: 0
|
||||
property bool _restoringScroll: false
|
||||
|
||||
function _toggleCollapse(appName) {
|
||||
const savedY = notifList.contentY;
|
||||
_savedScrollY = notifList.contentY;
|
||||
_restoringScroll = true;
|
||||
const next = Object.assign({}, _collapsedGroups);
|
||||
if (next[appName])
|
||||
delete next[appName];
|
||||
else
|
||||
next[appName] = true;
|
||||
_collapsedGroups = next;
|
||||
Qt.callLater(() => notifList.contentY = savedY);
|
||||
}
|
||||
|
||||
// Group notifications by appName, sorted by max urgency desc then most recent time desc
|
||||
|
|
@ -228,6 +231,13 @@ M.HoverPanel {
|
|||
boundsBehavior: Flickable.StopAtBounds
|
||||
model: menuWindow._flatModel
|
||||
|
||||
onContentHeightChanged: {
|
||||
if (menuWindow._restoringScroll) {
|
||||
contentY = Math.min(menuWindow._savedScrollY, Math.max(0, contentHeight - height));
|
||||
menuWindow._restoringScroll = false;
|
||||
}
|
||||
}
|
||||
|
||||
delegate: Item {
|
||||
id: notifDelegate
|
||||
required property var modelData
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue