I'm using a Qt/X11 Open Source 4.1.0 snapshot
What version are you using. If I remember well, this was new to 4.1.
Cheers
I'm using a Qt/X11 Open Source 4.1.0 snapshot
What version are you using. If I remember well, this was new to 4.1.
Cheers
no, Qt3X had it as well.
I think we are talking about different things here.Originally Posted by high_flyer
I was referring to
QTest::qSleep ( int ms )
which is new to QT4.1 i believe
not
QThread::sleep ( unsigned long secs )...
which was in Qt3X already as you said.
Our posts must have been made at about the same time.
Cheers
Last edited by Everall; 2nd February 2006 at 14:33.
Thanks, that's exactly what I need. Erm, just one thing ..if I call
QThread::msleep(10);
I get a compiler error cos it's static protected. I'm not going to have to subclass my object am I? i.e. inheirit QThread?
Kev
Qt Code:
I'm not going to have to subclass my object am I? i.e. inheirit QThread?To copy to clipboard, switch view to plain text mode
To create your own threads, you have to subclass QThread and reimplement run()
By the way, have you checked your QT version?
Sure, but I don't want another thread. I just want a sleep() func - something to suspend the main thread. A QThread::sleep() i.e. a public static func, would be perfect. Or alternativly, a QThread::currentThread()->sleep() would also do nicely. But I can't do it that way cos the sleep funcs are static protected.
anyway, I'm running 4.0.1 I guess I can update and as you suggest try a QTest::
thanks
K
Yes but sleep IS per thread.
And makes no sense to make a GUI thread (the main thread) sleep.
I don't know however what happens if you want to use sleep in a console application with Qt4...
But this thread might prove interesting for you:
http://lists.trolltech.com/qt-intere...ad00380-0.html
from that thread:
Qt Code:
#include <qthread.h> { public: static void sleep(unsigned long secs) { } static void msleep(unsigned long msecs) { } static void usleep(unsigned long usecs) { } };To copy to clipboard, switch view to plain text mode
Well, you know what? that's exactly what I want to do, and that's exactly why I want to do it. And, I think, that's exactly how I'll do it!
thanks very much,
Kev
Bookmarks