Rob
Rob

Reputation: 11788

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!

Upvotes: 1

Views: 611

Answers (1)

Dmitry Sazonov
Dmitry Sazonov

Reputation: 8994

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.

Upvotes: 2

Related Questions