Qt Threading mechanism

  • When we create multiple threads, is it necessary to include all UI objects in Main thread only?
    for example, if there are 20 threads in a application, can we include atleast one UI object in any thread except the Main thread.

  • no.
    all Ui must be inside main thread.
    other wise application can be frozen for awhile

  • No, only the main or GUI thread can work with UI objects.

    From "this":http://qt-project.org/doc/qt-5/thread-basics.html page:
    GUI Thread and Worker Thread
    As mentioned, each program has one thread when it is started. This thread is called the "main thread" (also known as the "GUI thread" in Qt applications). The Qt GUI must run in this thread. All widgets and several related classes, for example QPixmap, don't work in secondary threads. A secondary thread is commonly referred to as a "worker thread" because it is used to offload processing work from the main thread.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.