Results 1 to 5 of 5

Thread: processEvents() and GUI responsivity

  1. #1
    Join Date
    Jan 2006
    Posts
    6
    Thanks
    1

    Default processEvents() and GUI responsivity

    Hi all,
    first of all: my english is not good, so sorry for this....

    I have a strange problem with al little test that I am writing following:

    Qt Code:
    1. #include <QApplication>
    2. #include <QProgressDialog>
    3. int main(int argc, char* argv[])
    4. {
    5. QApplication app(argc, argv);
    6.  
    7. dlg.setRange(0, 0);
    8. dlg.show();
    9.  
    10. // I want to simulate a process that takes a long time
    11. for (int i = 0; i < 1000000; i++)
    12. {
    13. qDebug() << i;
    14.  
    15. // Call process event to have a GUI responsivity
    16. QCoreApplication::processEvents();
    17. }
    18.  
    19. dlg.hide();
    20. return app.exec();
    21. }
    To copy to clipboard, switch view to plain text mode 

    The program behaves as it should, but....if i click on ProgressDialog WindowBar (when lives close buttons :-) ) the loop counter freezes but the progress animation NOT! It 'a bit annoying.

    I'm something wrong? I can do something to prevent this behavior?

    I tried to intercept mouse events...
    I tried this test on Mac.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: processEvents() and GUI responsivity

    It seems to work OK on Linux. Which Qt version do you use exactly?

  3. #3
    Join Date
    Apr 2007
    Posts
    76
    Thanks
    6
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: processEvents() and GUI responsivity

    on my machine (linux running) it hides the dialog, but the counter is still running!

    gianpatt maybe your counter freeze because it comes to the end? (it is a stupid question but,...)

  4. #4
    Join Date
    Jan 2006
    Posts
    6
    Thanks
    1

    Default Re: processEvents() and GUI responsivity

    Quote Originally Posted by jacek View Post
    It seems to work OK on Linux. Which Qt version do you use exactly?
    4.3.4

    gianpatt maybe your counter freeze because it comes to the end? (it is a stupid question but,...)
    no...it freeze only when I click (and let down) on the window bar. If release the mouse count resume.

    if block esecution with GDB i have this back trace...
    it seems that main thread remains blocked while mouse is pressed down on window bar

    #0 0x90009cd7 in mach_msg_trap ()
    #1 0x90009c38 in mach_msg ()
    #2 0x9082d227 in CFRunLoopRunSpecific ()
    #3 0x9082ca42 in CFRunLoopRunInMode ()
    #4 0x92df1878 in RunCurrentEventLoopInMode ()
    #5 0x92df0f82 in ReceiveNextEventCommon ()
    #6 0x92e39a74 in _AcquireNextEvent ()
    #7 0x92eb4c70 in _TrackMouseLocationReturningEvent ()
    #8 0x92f570a0 in TWindowTracker::TrackWindow ()
    #9 0x930b0e66 in DragWindow ()
    #10 0x92f597d0 in HIWindowFrameView::TrackSelf ()
    #11 0x92e146a3 in HIView::EventHandler ()
    #12 0x92df04d7 in DispatchEventToHandlers ()
    #13 0x92defb7c in SendEventToEventTargetInternal ()
    #14 0x92defa41 in SendEventToEventTargetWithOptions ()
    #15 0x92eb3fb2 in SendControlDefTrack ()
    #16 0x92eb3dca in HIView::ClickInternal ()
    #17 0x92e8f025 in HIView::ClickSelf ()
    #18 0x92e14612 in HIView::EventHandler ()
    #19 0x92df04d7 in DispatchEventToHandlers ()
    #20 0x92defb7c in SendEventToEventTargetInternal ()
    #21 0x92df6f7c in SendEventToEventTarget ()
    #22 0x92e8ed4f in HIView::Click ()
    #23 0x92e8eb8b in HandleClickAsHIView ()
    #24 0x92e8e531 in HandleWindowClick ()
    #25 0x92e8dffe in HandleMouseEvent ()
    #26 0x92e36468 in StandardWindowEventHandler ()
    #27 0x92df04d7 in DispatchEventToHandlers ()
    #28 0x92defb7c in SendEventToEventTargetInternal ()
    #29 0x92df6f7c in SendEventToEventTarget ()
    #30 0x92df7999 in ToolboxEventDispatcherHandler ()
    #31 0x92df088e in DispatchEventToHandlers ()
    #32 0x92defb7c in SendEventToEventTargetInternal ()
    #33 0x92df6f7c in SendEventToEventTarget ()
    #34 0x0105bbe2 in qt_mac_send_event ()
    #35 0x0106906e in QEventDispatcherMac:rocessEvents ()
    #36 0x002bab37 in QCoreApplication:rocessEvents ()
    #37 0x00004435 in main ()


    Every idea will be much appreciated....

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: processEvents() and GUI responsivity

    Quote Originally Posted by gianpatt View Post
    no...it freeze only when I click (and let down) on the window bar. If release the mouse count resume.
    Ahh... I got it now. Such behavior was reported several times, but AFAIK it was on windows. You should better contact the Trolls (but try Qt 4.4.1 first).

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.