QTimer的暂停与重启

1.查看转载文章:

QT QTimer定时器的暂停,开启和重新启动问题_求丶空白灬的博客-CSDN博客_qtimer 暂停

2.QTimeEvent事件:

void timerEvent(QTimerEvent *event);

cycle_id = startTimer(1000);//启动比幅图定时器

if(event->timerId()==cycle_id)
    {
        static unsigned int pre_time_t=0;

        unsigned int cur_time_t=QDateTime::currentDateTime().toTime_t();

        if(pre_time_t!=cur_time_t)
        {
            SetCurrentTime_T(cur_time_t);
            pre_time_t=cur_time_t;
        }
   }

 killTimer(cycle_id);
void timerEvent(QTimerEvent *event);

 

你可能感兴趣的:(QT,qt)