close

在QT中利用QTimer可以做某事件重複執行的動作

 

QTimer *timer = new QTimer(&rfid);

QObject::connect(timer, SIGNAL(timeout()), &rfid, SLOT(ReadTagInfo()));    timer->start(1000);


  timer->start(1000);  裡面的數字就是設定他的時間範圍,1000毫秒=1秒


還有另一個

QTimer::singleShot(1000, &app, SLOT(quit()));

不過singleShot(),只能跑一次,即時間到就結束視窗。


arrow
arrow
    全站熱搜

    flykof 發表在 痞客邦 留言(1) 人氣()