I guess you could use a QTimer, that you check for elapsed time and reset it whenever the application receives a mouse or key event?