How to detect when a window has lost focus?
Unsolved
General and Desktop
-
Look for QEvent::FocusIn and QEvent::FocusOut events.
-
No, that's not it. When I alt+tab out of the window, no FocusOut event is fired. I'm testing with http://doc.qt.io/qt-5/qwindow.html#focusOutEvent.
-
QObject::connect(qApp, &QGuiApplication::applicationStateChanged, this, [=](Qt::ApplicationState state){ qDebug() << state; });