-
Bug
-
Resolution: Done
-
Not Evaluated
-
None
-
5.13.0
-
None
When trying to hook up the WindowManager with a SwipeView I needed to write some glue code, as the raiseApplicationWindow exposed an applicationId and not a window. The WindowManager provides a function to get an index from a window but there is no direct way to get a window from an applicationId.
See example below
SwipeView {
id: stackView
anchors.fill: parent
Repeater {
model: WindowManager
Loader {
sourceComponent: AppWindow {
window: model.window
}
onLoaded: stackView.currentIndex = SwipeView.index
}
}
}
Connections {
target: WindowManager
onWindowAdded: {
console.log("window added")
}
onRaiseApplicationWindow: {
console.log("raise window: ", applicationId)
// GLUE CODE
for(var i=0; i<WindowManager.count; i++) {
var surface = WindowManager.get(i)
console.log(surface.applicationId, applicationId)
if (surface.applicationId === applicationId) {
stackView.currentIndex = i
}
}
}
}
Ideally I would like write
onRaiseApplicationWindow: {
console.log("raise window: ", applicationId)
stackView.currentIndex = WindowManager.indexOfWindow(window)
}