Qt 6.11 is out! See what's new in the release
blog
How to detect when a window has lost focus?
-
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; });