I am trying to override the onClosing event in a QML application window.
The qml for the window is simple as:
ApplicationWindow {
id: rootWindow
objectName: "window"
visible: true
width: 800
height: 480
property Component loginForm: LoginView {}
onClosing: {
loginForm.logout()
}
}
The LoginView view is simple as well:
Rectangle {
id: view
function logout() {
console.log("Logout called");
}
}
Now, as is, it returns an error:
TypeError: Property 'logout' of object QQmlComponent(0x9287150) is not a function
I also tried loginForm.view.logout() and this returns in:
TypeError: Cannot call method 'logout' of undefined