Results 1 to 6 of 6

Thread: how to abort a function taking to long to process

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #4
    Join Date
    Jul 2008
    Location
    Germany
    Posts
    520
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    13
    Thanked 77 Times in 75 Posts

    Default Re: how to abort a function taking to long to process

    QCoreApplication::processEvents is static. Just add a call to your for loop:
    Quote Originally Posted by john_god View Post
    Qt Code:
    1. for (i=0;i<Lots_of_calculation && !bAbort ;i++) // set bAbort in keyPressEvent or wherever you like
    2. {
    3. ....
    4. lots of calculation;
    5. QCoreApplication::processEvents (); // <-- new
    6. blablabla...;
    7. more calculation;
    8. .....
    9. }
    To copy to clipboard, switch view to plain text mode 
    Ginsengelf
    Last edited by Ginsengelf; 15th April 2009 at 07:03. Reason: messed up tags

  2. The following user says thank you to Ginsengelf for this useful post:

    john_god (30th April 2009)

Similar Threads

  1. QPSQL problem
    By LoneWolf in forum Installation and Deployment
    Replies: 60
    Last Post: 4th November 2009, 14:22
  2. Regading Driver to connect Postgresql Database
    By dummystories in forum Installation and Deployment
    Replies: 38
    Last Post: 12th March 2009, 07:19
  3. QPSQL driver in windows
    By brevleq in forum Installation and Deployment
    Replies: 31
    Last Post: 14th December 2007, 12:57
  4. how to add static library into qmake
    By Namrata in forum Qt Tools
    Replies: 1
    Last Post: 20th November 2007, 17:33
  5. use qpsql
    By raphaelf in forum Installation and Deployment
    Replies: 34
    Last Post: 22nd August 2006, 12:52

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.