i've got a QObject-based class instantiated in a QThread run(), name
it Timer. It just encapsulates a QTimer and some support logic. Now
from inside the Timer, i want to suspend the thread for some defined
time, just like Sleep() of Win32 fame - actually i am porting some
MFC-heavy code to Qt. I don't care about stopped event loop, it's
really simple dedicated thread. What is the nice and correct way to do
it in Qt? QThread::sleep (msleep, usleep) is protected.
QThread::wait() is not intended for this usage, as it displays "Thread
tried to wait on itself". To solve things fast, I have eventually
ended with a public method of my QThread-derived class, which only
calls QThread::msleep, and i am casting thread() inside Timer to be
able to call it. Is that as dirty as i feel about it?
To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
"unsubscribe" in the subject or the body.
List archive and information: http://lists.trolltech.com/qt-interest/