Answer the question
In order to leave comments, you need to log in
How to track user inactivity in QT?
There is a project on QT (Widgets) | Ubuntu OS, but Windows is also possible |
There is a timer in the project that must be reset if the user does something ... at least presses the keys, even moves the mouse around the screen (roughly speaking, the timer action should occur if the user does nothing).
Let's simplify the task: the program works in fullscreen (i.e. you don't need to follow the actions outside the form/widget).
Question: how? =)
Answer the question
In order to leave comments, you need to log in
For Qt, there is an additional library - Qxt, in the tests there is an application that demonstrates just what you need: idle time is displayed in the window title when the user moves the mouse or presses a key or performs some other action - the counter is reset.
You can use Qxt in your project (versions for Mac OS, Win and Linux are available), or pull out the implementation of the idleTime() function for various systems:
Win , X11 (GNU/Linux) , Mac OS .
You can download Qxt here .
All descendants of QObject have eventFilter and installEventFilter methods. You just call installEventFilter on the object you want to watch and pass it a pointer to the object that will watch it (maybe just a pointer to yourself):
qt-project.org/doc/qt-4.8/qobject.html#eventFilter
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question