Quote Originally Posted by Valheru View Post
Hmm, it doesn't seem to like being passed an int as argument for the creator of QEvent. Would it be safe to statically cast it to QEvent::Type?
Yes.

Quote Originally Posted by jpn View Post
The behaviour is exactly the same with posting events. The event gets processed in the event loop running in the thread where the receiver object lives in. Since the QThread object lives in the main thread, it's customEvent() gets executed in the main thread as well.
Hmm... I thought exec() moves the object into the thread. If it doesn't, it should be enough to move it inside run():

Qt Code:
  1. void MyThread::run(){
  2. moveToThread(this);
  3. exec();
  4. }
To copy to clipboard, switch view to plain text mode