How to detect if a Qt GUI application has been idle, inside the app itself (Qt)?

后端 未结 2 1676
情话喂你
情话喂你 2021-01-02 12:08

How to detect when a GUI application has been idle, (ie, no user interaction), for a period of time ?

I have n number of Qt Screens , I want to bring Date-Time scree

2条回答
  •  情话喂你
    2021-01-02 12:49

    According to QT Documentation :

    To make your application perform idle processing (i.e. executing a special function whenever there are no pending events), use a QTimer with 0 timeout. More advanced idle processing schemes can be achieved using processEvents().

    So you need to create a QTimer with zero timeout interval and connect it to your slot that is called when application is idle.

提交回复
热议问题