fix: backdrop never renders on startup when currentIndex stays at 0

onCurrentIndexChanged does not fire if the index was already 0 when the model populated. Use Component.onCompleted + callLater to emit gameFocused for the initial item.
This commit is contained in:
Marco Allegretti 2026-03-23 12:05:28 +01:00
parent 09cdba516b
commit 44f87d6f14

View file

@ -89,6 +89,13 @@ FocusScope {
if (g) libraryRoot.gameFocused(g) if (g) libraryRoot.gameFocused(g)
} }
Component.onCompleted: {
Qt.callLater(function() {
let g = proxyModel.get(currentIndex)
if (g) libraryRoot.gameFocused(g)
})
}
delegate: GameCard { delegate: GameCard {
game: model.gameObject game: model.gameObject
gridActive: grid.flickable ? grid.flickable.activeFocus : grid.activeFocus gridActive: grid.flickable ? grid.flickable.activeFocus : grid.activeFocus