Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Not to freeze the main window while running a loop of threads
QtWS25 Last Chance

Not to freeze the main window while running a loop of threads

Scheduled Pinned Locked Moved Unsolved General and Desktop
qthreadthreadthreadsthreading
3 Posts 3 Posters 475 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sylvalas
    wrote on last edited by
    #1
    class mythread(QThread):
        ...
    class main():
        ....
        for i in range(10):
           self.thread=mythread()
           self.thread.start()
           seld.thread.wait()
    

    without wait(), the 10 threads will be built continuously. With wait(), the main window freeze.
    is there a way to solve this?

    Thanks!!!

    1 Reply Last reply
    0
    • Christian EhrlicherC Online
      Christian EhrlicherC Online
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @sylvalas said in Not to freeze the main window while running a loop of threads:

      is there a way to solve this?

      Don't call self.thread.wait()

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi,

        In addition to @Christian-Ehrlicher, what exactly are you trying to achieve ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved