我需要每秒通过和Upd套接字发送Qt应用程序的状态。我怎样才能做到这一点呢?我应该使用QThread::sleep子类化QThread e,还是有最好的方法?谢谢
发布于 2012-09-21 15:54:20
最后,我使用了一种不同的方法:
A QTimer:
QTimer iAmAliveTimer.setInterval(1500);
iAmAliveTimer.setSingleShot(true);
connect(&iAmAliveTimer, SIGNAL(timeout()), this, SLOT(sendIamAlive()), Qt::UniqueConnection);
iAmAliveTimer.start();当SLOT被调用时,我通过我的套接字发送我需要的东西。
https://stackoverflow.com/questions/12492334
复制相似问题