Fix shortcuts in instanciators breaking on reload

When reloading the config file, the HShortcut within Instanciators (e.g.
Rooms.AtIndex) were deleted then recreated.
Except Shortcut happens to be an indestructible object type.
Thus the old HShortcuts left alive were conflicting with the ones
recreated, causing them to be called ambiguously.
Loaders are destructible, so we wrap the shortcuts inside one to fix the
issue.
This commit is contained in:
miruka 2021-04-15 16:49:40 -04:00
parent 3279a1befd
commit 61996400d0

View File

@ -266,17 +266,21 @@ HListView {
Instantiator { Instantiator {
model: Object.keys(window.settings.Keys.Accounts.AtIndex) model: Object.keys(window.settings.Keys.Accounts.AtIndex)
delegate: HShortcut { delegate: Loader {
sequences: window.settings.Keys.Accounts.AtIndex[modelData] sourceComponent: HShortcut {
onActivated: goToAccountNumber(parseInt(modelData, 10) - 1) sequences: window.settings.Keys.Accounts.AtIndex[modelData]
onActivated: goToAccountNumber(parseInt(modelData, 10) - 1)
}
} }
} }
Instantiator { Instantiator {
model: Object.keys(window.settings.Keys.Rooms.AtIndex) model: Object.keys(window.settings.Keys.Rooms.AtIndex)
delegate: HShortcut { delegate: Loader {
sequences: window.settings.Keys.Rooms.AtIndex[modelData] sourceComponent: HShortcut {
onActivated: showAccountRoomAtIndex(parseInt(modelData, 10) - 1) sequences: window.settings.Keys.Rooms.AtIndex[modelData]
onActivated: showAccountRoomAtIndex(parseInt(modelData, 10) - 1)
}
} }
} }