I am porting the gui of an app from wxwidgets to Qt. It's fairly large and I want to do as little disruption as possible. One thing that I am not sure how to handle is that other threads call the main (ui) thread and ask it to do functions using:

Qt Code:
  1. void async_ui_thread_task(const boost::function<void()>& f) {
  2. wxCommandEvent event(wxEVT_EVAL);
  3. event.SetClientData(new boost::function<void ()>(f));
  4. wxGetApp().AddPendingEvent(event);
  5. }
To copy to clipboard, switch view to plain text mode 

I am trying to find an equivalent Qt way to do this. I cannot convert the existing thread types to QtThreads. I've looked at QApplication/QCoreApplication and the only thing I can think of is to create my own events and put the functions in these events. The problem is how do I get the right receiver to process them (assuming that I use QCoreApplication:: postEvent). Some do not belong to objects and some are private functions (I can make them public if that is what it takes).

Has anyone had any experience with this?