[Qt-interest] Adding delay in Qt

Donal O'Connor donaloconnor at gmail.com
Tue Mar 31 14:24:41 CEST 2009


If it is a thread you can use msleep()

Otherwise you can create a temp class (taken from previous mails):

class SleeperThread : public QThread
{
public:
static void msleep(unsigned long msecs)
{
QThread::msleep(msecs);
}
};

Then you can use it where ever by calling:

SleeperThread::msleep(n); where n is milliseconds



On Tue, Mar 31, 2009 at 1:07 PM, R. Reucher <rene.reucher at batcom-it.net>wrote:

> On Tue March 31 2009 14:00:51 Keshava Krishna wrote:
> > i need to add delay in a loop, is there any way of doing it in qt?
> > can i use time.h header of C?
> > if yes please tell me how to include it...
> I've successfully used QTest::qWait(int) to accomplish this... you have to
> add "CONFIG += qtestlib" to your .pro file, though.
>
> HTH, René
> --
> René Reucher
> rene.reucher at batcom-it.net
> http://www.batcom-it.net/
>
> Too much of everything is just enough.
>                -- Bob Wier
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090331/ce3eac5e/attachment.html 


More information about the Qt-interest-old mailing list