|
|
I was using the following code:
--- delay.h ----
#include <QtCore/QTime>
inline void delay(long ms)
{
QTime time;
time.start();
while (time.elapsed()<ms);
}
then I found that the following should be possible as well:
--- delay.h ----
#include <QtCore/QThread>
class SleeperThread : public QThread
{
public:
static void msleep(unsigned long msecs)
{
QThread::msleep(msecs);
}
};
inline void delay(long ms)
{
SleeperThread::msleep(ms);
}
If I however use the latter approach inside a thread I see that the
function delay(1000) returns immediately.
Did I understand something wrong? Which is the recommanded solution?
I know that in a thread I could as well use msleep, but I would like to
have a solution which can be used anywhere
in the programm and also outside of QThread classes.
Matthias
_______________________________________________
Qt-interest mailing list
Qt-interest@xxxxxxxxxxxxx
http://lists.trolltech.com/mailman/listinfo/qt-interest
|
|