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. Number of active QThreads
Forum Updated to NodeBB v4.3 + New Features

Number of active QThreads

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 297 Views 1 Watching
  • 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.
  • T Offline
    T Offline
    TurashviliAlik
    wrote on last edited by TurashviliAlik
    #1

    Is there any way to get pointers to all active QThreads at any point in the application? I realize that I can create a class inherited from QThread and implement this functionality there, but I am interested in the standard QThread.
    I've tried looking at the events received in "eventFilter", but it didn't give any result

    jsulmJ C 2 Replies Last reply
    0
    • T TurashviliAlik

      Is there any way to get pointers to all active QThreads at any point in the application? I realize that I can create a class inherited from QThread and implement this functionality there, but I am interested in the standard QThread.
      I've tried looking at the events received in "eventFilter", but it didn't give any result

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @TurashviliAlik QThread does not have such functionality (and I don't know why you would need it).
      If you're using thread pools you can use https://doc.qt.io/qt-6/qthreadpool.html#activeThreadCount-prop

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      3
      • T TurashviliAlik

        Is there any way to get pointers to all active QThreads at any point in the application? I realize that I can create a class inherited from QThread and implement this functionality there, but I am interested in the standard QThread.
        I've tried looking at the events received in "eventFilter", but it didn't give any result

        C Offline
        C Offline
        ChrisW67
        wrote on last edited by
        #3

        @TurashviliAlik
        Since you are creating these QThread objects why not just keep a QList<QThread*> . Alternatively, parent them all to a single QObject (like qApp) and then find them with QObject::findChildren()

        QList<QThread *> threads = qApp->findChildren<QThread*>();
        

        Like @jsulm, I am not sure why you would need this.

        1 Reply Last reply
        3

        • Login

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