屏幕解锁时调用函数
Call a function when screen is unlocked
我打开应用程序并将其聚焦在 android phone 上,然后我锁定了屏幕。当我解锁它时,我想调用一个特定的函数。
我在想Qt.application.state
,可是函数发生变化了怎么调用呢?
您正在搜索 void QGuiApplication::applicationStateChanged(Qt::ApplicationState state)
。
void QGuiApplication::applicationStateChanged(Qt::ApplicationState state)
This signal is emitted when the state of the application changes.
This function was introduced in Qt 5.2.
只需在您的 C++
代码部分连接到此信号,检查 state == Qt::ApplicationActive
并触发您 QML
部分中的某些功能。
我打开应用程序并将其聚焦在 android phone 上,然后我锁定了屏幕。当我解锁它时,我想调用一个特定的函数。
我在想Qt.application.state
,可是函数发生变化了怎么调用呢?
您正在搜索 void QGuiApplication::applicationStateChanged(Qt::ApplicationState state)
。
void QGuiApplication::applicationStateChanged(Qt::ApplicationState state)
This signal is emitted when the state of the application changes.
This function was introduced in Qt 5.2.
只需在您的 C++
代码部分连接到此信号,检查 state == Qt::ApplicationActive
并触发您 QML
部分中的某些功能。