PDA

View Full Version : When application is not used



been_1990
5th September 2010, 19:03
How can I know when the application is not being used, ex:
user switches windows, minimizes app, etc..?

Lykurg
5th September 2010, 19:20
One option is QWidget::hasFocus() or the focusOutEvent().

been_1990
6th September 2010, 00:52
I thought hasFocus() only applied to keyboard focus, as stated in the documentation.

been_1990
8th September 2010, 11:15
Besides hasFocus() are there other methods?

tbscope
8th September 2010, 11:20
Scan the input events.
If for a certain amount of time there's no input event, then there is a probability that it is not being used (not a certainty)

As for minimizing, there's an event for that too.
The switching windows is handled by the focus event as already stated.