Results 1 to 12 of 12

Thread: where's the sleep() func?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows
    Thanks
    21
    Thanked 418 Times in 411 Posts

    Default Re: where's the sleep() func?

    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:
    1. #include <qthread.h>
    2.  
    3. class I : public QThread
    4. {
    5. public:
    6. static void sleep(unsigned long secs) {
    7. QThread::sleep(secs);
    8. }
    9. static void msleep(unsigned long msecs) {
    10. QThread::msleep(msecs);
    11. }
    12. static void usleep(unsigned long usecs) {
    13. QThread::usleep(usecs);
    14. }
    15. };
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany.
    Posts
    111
    Qt products
    Qt3 Qt4
    Platforms
    Windows
    Thanks
    29
    Thanked 3 Times in 2 Posts

    Default Re: where's the sleep() func?

    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

Similar Threads

  1. How do you sleep when using a QTimer
    By newqtuser in forum Qt Programming
    Replies: 0
    Last Post: 30th October 2008, 00:49
  2. how to sleep with qt function?
    By yleesun in forum Qt Programming
    Replies: 2
    Last Post: 5th August 2008, 12:08
  3. Sleep condition in QT
    By santhoshv84 in forum Qt Programming
    Replies: 1
    Last Post: 18th July 2008, 12:07
  4. sleep
    By sonuani in forum Newbie
    Replies: 1
    Last Post: 17th March 2008, 12:37
  5. sleep - sleeps, but not when I want it to sleep
    By nongentesimus in forum Newbie
    Replies: 2
    Last Post: 2nd March 2006, 14:43

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.