Sure it is.Is it not possible to post custom events (across thread) to a QThread descendant?
Do you get the debug message in your postEvent() slot?
Sure it is.Is it not possible to post custom events (across thread) to a QThread descendant?
Do you get the debug message in your postEvent() slot?
I don't mean that the event wouldn't get delivered at all. Sure it does. But it will get sent directly and processed in the main thread, meaning the it will steal main thread's execution time and so the GUI will get blocked. The point with the debug message in MyThread::customEvent() is that it will show you the current executing thread, which is the main thread.Originally Posted by high_flyer
I somewhy would have expected that posting a custom event to a QThread object would have got processed in it's own event loop. But it will get processed in it's owner's event loop instead (the main GUI thread in this case).
J-P Nurmi
I am not sure 100%, but I think this was the case in Qt3.I somewhy would have expected that posting a custom event to a QThread object would have got processed in it's own event loop.
At least thats is the way I worked with threads in Qt3 and it did work for me.
But you are working now with Qt4.
And here the docs say:
And since your button was created in the main loop, and the QThread in it is its child, the events get posted in the main event loop.A QObject instance is said to live in the thread in which it is created. Events to that object are dispatched by that thread's event loop.
jpn (4th July 2006)
Bookmarks