Important: Please read the Qt Code of Conduct -

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

  • 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?

  • I had a similiar problem once.
    Take a look at "this thread":

  • If you're working with QThreads for the first time you should have a look at "the new QThread documentation": which has been updated for Qt 5. You don't need to use Qt 5 for your code to work like this. The way to work with QThreads as described in the new documentation works with all Qt versions starting from 4.4.

    Most important thing to consider is: if you can avoid it DO NOT SUBCLASS QTHREAD.

Log in to reply