Results 1 to 8 of 8

Thread: MainWindow update during computations

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2006
    Location
    San Francisco, CA
    Posts
    186
    Qt products
    Qt4
    Platforms
    MacOS X Windows
    Thanks
    55
    Thanked 12 Times in 11 Posts

    Default Re: MainWindow update during computations

    Quote Originally Posted by Gizmho
    Does the call processEvents() slow down the application?
    Probably just the price of a function call, multiplied by how many times you need to call it, as well as the cost of processing the events. But that's just the price of having your application "feel" like it's doing multitasking and being responsive. You can't get things for free. For the most part, the performance drop should be negligible.
    Software Engineer



  2. #2
    Join Date
    Jul 2006
    Posts
    79
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    13
    Thanked 2 Times in 2 Posts

    Default Re: MainWindow update during computations

    how does this handle the following thing:

    Qt Code:
    1. computing very much A
    2. break -> processEvents()
    3. compute something
    4. compute something
    5. compute very much B
    6. continue with A
    7. computing very much A
    8. ..
    To copy to clipboard, switch view to plain text mode 


    will A continue only after B is finished?
    so when i call A in B, then i'll get a recursion?

    regards..
    aman..

  3. #3
    Join Date
    Apr 2006
    Location
    San Francisco, CA
    Posts
    186
    Qt products
    Qt4
    Platforms
    MacOS X Windows
    Thanks
    55
    Thanked 12 Times in 11 Posts

    Default Re: MainWindow update during computations

    Yes, according to the docs, processEvents() processes all pending events before returning - all this work is done in the same thread. So, if function A() calls processEvents(), and one of the event handlers (perhaps B()) then calls A() again, there might be some recursion. I don't think it would be infinite recursion; the event being processed must be removed from the list of pending events before getting processed, and it looks like Qt follows this at least in Windows (in qeventdispatcher_win.cpp):
    msg = d->queuedUserInputEvents.takeFirst();

    The funny result is that events might be processed in reverse order as it finishes its recursion; but the processing should go on as the pending event list is whittled away.
    Software Engineer



  4. #4
    Join Date
    Jul 2006
    Posts
    79
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    13
    Thanked 2 Times in 2 Posts

    Default Re: MainWindow update during computations

    thank you, that helped me understand the system..

    regards..
    aman..

Similar Threads

  1. Paint MainWindow Regions
    By pedros09 in forum Qt Programming
    Replies: 1
    Last Post: 5th May 2006, 09:43
  2. mainwindow does not refresh
    By edb in forum Qt Programming
    Replies: 22
    Last Post: 25th January 2006, 16:42
  3. Update a row
    By dragon in forum Newbie
    Replies: 9
    Last Post: 17th January 2006, 17:11

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.