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,19 +266,23 @@ HListView {
Instantiator {
model: Object.keys(window.settings.Keys.Accounts.AtIndex)
delegate: HShortcut {
delegate: Loader {
sourceComponent: HShortcut {
sequences: window.settings.Keys.Accounts.AtIndex[modelData]
onActivated: goToAccountNumber(parseInt(modelData, 10) - 1)
}
}
}
Instantiator {
model: Object.keys(window.settings.Keys.Rooms.AtIndex)
delegate: HShortcut {
delegate: Loader {
sourceComponent: HShortcut {
sequences: window.settings.Keys.Rooms.AtIndex[modelData]
onActivated: showAccountRoomAtIndex(parseInt(modelData, 10) - 1)
}
}
}
Rectangle {
anchors.fill: parent