Running a slot on each iteration of the application event loop

How can I name my slot on each iteration of the application event loop? The only way I know is to use QTimer and every timeout (every millisecond) signal that I can call my slot. But I do not like this option, it looks like a workaround.

Any suggestions on how to do this more correctly?

+3
source share
2 answers

From the Qt 4.7 documentation, QCoreApplication :: exec ():

To allow the application to perform processing downtime (that is, to execute a special one in the absence of pending events), use QTimer with a timeout of 0. More advanced inaction processing schemes can be achieved using processEvents ().

, - , . QCoreApplication:: processEvents() .

+3

installEventFilter QCoreApplication:: instance(). .

0

Source: https://habr.com/ru/post/1794846/


All Articles