Search code examples
qtqt4armtouchscreenbeagleboneblack

How to detect inactivity for automatic logoff?


I'm currently building a Qt4 application that runs on an ARM board in an industrial environment. It comes with a 7" touchscreen that is used for visualizing and configuring the values and parameters of a machine.

There are 3 different user levels: standard user (just view), authenticated user (may set parameters and send commands) and admin (can also configure datapoints etc).

Now I want to implement an auto-logoff to avoid any security problems when an admin user forgets to log off properly. What would be the best and easiest way? I basically need a timer that starts after a login and that gets resetted every time the user touches the screen (or moves the mouse). The timer is not a problem - but how can I properly detect mouse/touchscreen events? Thanks for your help!


Solution

  • You may install event filter on QApplication instance and track user input events. On each user input event - you reset a timer. But be careful, because it may affect your performance a bit.