Results 1 to 2 of 2

Thread: Frame-by-frame event handling?

  1. #1
    Join Date
    Sep 2013
    Posts
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Frame-by-frame event handling?

    So because of some fairly slow stuff going on in the background, I need to have a separate thread that is in communication with the GUI so that the main thread doesn't lock up. What I decided to do was pass stuff from my new thread to the Qt GUI class, then have an event handler for my GUI that handles all the communication. This works very nicely because any time a key is pushed, the cursor moves, or the mouse is clicked, the event handler is called. The problem is that if you're not interacting with the program in any way then the event handler doesn't handle the communication from the thread properly. So, long story short, I'm looking for either a way to setup a signal on the main window of my GUI that is called every frame, a way to setup the event handler to be called every frame, or any number of other solutions that would solve my problem. I simply need to communicate to the GUI from a separate thread and, because it's not thread safe, I can't do that directly, so I need some sort of handler called every frame.
    Last edited by QTNovice; 28th October 2013 at 18:38.

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Frame-by-frame event handling?

    You use signals and slots to communicate between threads not the event handler protected functions. If the GUI is supposed to update when the thread sends a signal then connect that signal to a slot that does the update. If your GUI needs to update some display on a periodic basic you can use a QTimer.

Similar Threads

  1. Video Parsing - Frame by Frame
    By ctote in forum Qt Programming
    Replies: 3
    Last Post: 15th February 2010, 18:30
  2. PNG that contains more than one frame
    By sophister in forum Qt Programming
    Replies: 2
    Last Post: 8th December 2009, 15:33
  3. Previous frame inner to this frame(corrupt stack?)
    By coralbird in forum Qt Programming
    Replies: 1
    Last Post: 28th May 2007, 01:35
  4. The event fired by the mouse click on the frame
    By Placido Currò in forum Qt Programming
    Replies: 8
    Last Post: 3rd March 2007, 09:05
  5. Previous frame inner to this frame(corrupt stack?)
    By coralbird in forum Qt Programming
    Replies: 17
    Last Post: 29th April 2006, 01:42

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.