Does Qt application/ mainwindow or some other class provides an API to to detect whether a Qt application is running in foreground or background ?
Or is there some kind of signal/ slot mechanism for the same. Thanks
Does Qt application/ mainwindow or some other class provides an API to to detect whether a Qt application is running in foreground or background ?
Or is there some kind of signal/ slot mechanism for the same. Thanks
Did you try checking QWidget::isVisible(), QWidget::isMinimized() and QWidget::isActive()?
Thanks wysota.. I actually want a Signal mechanism.
As in when some other application comes in foreground, i receive a signal in my running application and in the corresponding slot I can perform some action.
the above API's you mentioned can be used when I specifically want to check the status of my application.
You asked for an API, you got an API. If you want a signal, ask for a signal
A suitable signal might be QApplication::focusChanged.
Bookmarks