I am running my Qt application on Qt 5.9.3 on Android and iOS. I want to listen to QGuiApplication::applicationStateChanged directly on a QML file
How can I listen to application state changes on QML using connection without having to write any code to emit signals from my C++ classes.
I want to listen to Qt::ApplicationState::ApplicationInactive
and Qt::ApplicationState::ApplicationActive
events using a connection. Using something like this in my QML file.
Connections {
target: something_but_what
onApplicationStateChanged: {
console.log("State changed", state)
}
}
How can I achieve this?