문제

I need to send the status of my Qt application through and Upd socket every seconds. How can I achive this? Should I subclass QThread e using QThread::sleep or is there a best approch ? thanks

도움이 되었습니까?

해결책

In the end I use a different approch:

a QTimer:

QTimer iAmAliveTimer.setInterval(1500);
iAmAliveTimer.setSingleShot(true);
connect(&iAmAliveTimer, SIGNAL(timeout()), this, SLOT(sendIamAlive()), Qt::UniqueConnection);
iAmAliveTimer.start();

when the SLOT is called, I send what I need through my socket.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top