example 'meshtastic': review WiFi mode

This commit is contained in:
pls.153 2024-05-03 16:50:27 +02:00
parent df62fd4a21
commit 5e16e9594e
7 changed files with 90 additions and 45 deletions

View file

@ -106,12 +106,16 @@ QT::QT() : QObject() {
// background mode
QObject::connect(qGuiApp, &QGuiApplication::applicationStateChanged,
[&](Qt::ApplicationState state) {
static bool ok = false; // for startup
if (state == Qt::ApplicationInactive) {
ok = true;
con->setBackgroundMode(true);
ecl_fun("app:background-mode-changed", true);
} else if (state == Qt::ApplicationActive) {
con->setBackgroundMode(false);
ecl_fun("app:background-mode-changed", false);
if (ok) {
con->setBackgroundMode(false);
ecl_fun("app:background-mode-changed", false);
}
}
});
#endif