Results 1 to 4 of 4

Thread: calling event through in loop

  1. #1
    Join Date
    Feb 2007
    Posts
    63
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default calling event through in loop

    Hi,
    in my application i am using QCustomEvent and posting that event throug a for loop.

    Qt Code:
    1. for(usIndex=0;usIndex<4;usIndex++)
    2. {
    3.  
    4. EnggEvent *engEvent = new EnggEvent();
    5. QApplication::postEvent(receiver, engEvent);
    6.  
    7. }
    To copy to clipboard, switch view to plain text mode 

    Now the problem is that when i do this the event get called only at the end of the loop i.e when the usIndex becomes 3.

    How to solve this problem.

    Regards
    Raghvendra
    Last edited by jpn; 27th February 2008 at 06:47. Reason: missing [code] tags

  2. #2
    Join Date
    Jan 2006
    Location
    Bremen, Germany
    Posts
    554
    Thanked 86 Times in 81 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: calling event through in loop

    Search the forum or take a look at QCoreApplication::processEvents
    Last edited by jpn; 28th February 2008 at 06:19. Reason: disabled smilies

  3. #3
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: calling event through in loop

    Notice the difference between QApplication::sendEvent() and QApplication::postEvent().
    J-P Nurmi

  4. #4
    Join Date
    Feb 2007
    Posts
    63
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: calling event through in loop

    Thnx .
    I have used sendEvent() and it solved the problem......

Similar Threads

  1. event loop isStarted() signal?
    By Xerion in forum Qt Programming
    Replies: 1
    Last Post: 18th February 2008, 21:45
  2. Main Thread Event loop
    By ^NyAw^ in forum Qt Programming
    Replies: 1
    Last Post: 20th March 2007, 12:10
  3. Glib event loop
    By Brandybuck in forum Qt Programming
    Replies: 2
    Last Post: 28th September 2006, 17:19
  4. Workload in a QThread blocks main application's event loop ?
    By 0xBulbizarre in forum Qt Programming
    Replies: 14
    Last Post: 9th April 2006, 21:55
  5. Replies: 4
    Last Post: 23rd January 2006, 16:51

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.