Qt之利用系统空闲
如何利用系统空闲,处理指定函数?
To make your application perform idle processing (by 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().
- 方法1 使用int QObject::startTimer(int interval, Qt::TimerType timerType = Qt::CoarseTimer)
If interval is 0, then the timer event occurs once every time there are no more window system events to process.
- 方法2 在处理函数中调用processEvents(),这样也可以防止出现主进程卡的情况