Results 1 to 4 of 4

Thread: QTimer or recursive calls for simulation?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2006
    Posts
    209
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    13

    Default Re: QTimer or recursive calls for simulation?

    Great!
    I would really like it to draw at maximum speed without any pauses (even if they are really short) and I wish to avoid any problem if it timeout before drawing and calculations are done.
    Is there a non-crashing solution to this other than to generate all data and then animate it afterwards?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,373
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    3
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: QTimer or recursive calls for simulation?

    Use a singleshot QTimer with 0 timeout time. It will trigger instantly when all previous events are handled.

    Qt Code:
    1. void MyClass::myTimeoutSlot(){
    2. doSomething();
    3. update();
    4. QTimer::singleShot(0, this, SLOT(myTimeoutSlot()));
    5. }
    To copy to clipboard, switch view to plain text mode 

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.