PDA

View Full Version : How to use GUI in a user-interface thread by adding a message queue in the thread?



Michael_BJFU
25th October 2012, 10:07
I know that Qt maintains its gui messages in the main-thread called gui-thread. However if I post too many messages to the main gui thread, the main thread won't respond to the messages quickly and react to the user input. In windows, OS provides a solution that to create a user-interface thread with a standalone message queue itself. So I can post my message to this thread while the main thread will not die.
So my question is how to create a gui thread but not the main thread in Qt?

wysota
25th October 2012, 16:10
What exactly do you think is going to happen if you post 1000 messages to thread A instead of thread B? How is it going to be different from what you already have? If you want to post some custom events that are unrelated to the user interface then post them to a worker thread instead of the UI thread.