Save/load which room categories are collapsed

This commit is contained in:
miruka 2019-07-21 09:35:52 -04:00
parent f7d286cdc2
commit 238f38c9f0
2 changed files with 16 additions and 3 deletions

View File

@ -12,9 +12,8 @@ Column {
property var userInfo: users.find(model.userId) property var userInfo: users.find(model.userId)
property bool expanded: true property bool expanded: true
Component.onCompleted: { Component.onCompleted:
expanded = ! window.uiState.collapseAccounts[model.userId] expanded = ! window.uiState.collapseAccounts[model.userId]
}
onExpandedChanged: { onExpandedChanged: {
window.uiState.collapseAccounts[model.userId] = ! expanded window.uiState.collapseAccounts[model.userId] = ! expanded

View File

@ -20,12 +20,26 @@ Column {
property string roomListUserId: userId property string roomListUserId: userId
property bool expanded: true property bool expanded: true
Component.onCompleted: {
if (! window.uiState.collapseCategories[model.userId]) {
window.uiState.collapseCategories[model.userId] = {}
window.uiStateChanged()
}
expanded = !window.uiState.collapseCategories[model.userId][model.name]
}
onExpandedChanged: {
window.uiState.collapseCategories[model.userId][model.name] = !expanded
window.uiStateChanged()
}
HRowLayout { HRowLayout {
width: parent.width width: parent.width
HLabel { HLabel {
id: roomCategoryLabel id: roomCategoryLabel
text: name text: model.name
font.weight: Font.DemiBold font.weight: Font.DemiBold
elide: Text.ElideRight elide: Text.ElideRight