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. Check if all children of QNetworkAccessManager is running
QtWS25 Last Chance

Check if all children of QNetworkAccessManager is running

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 592 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.
  • M Offline
    M Offline
    Mr Gisa
    wrote on last edited by Mr Gisa
    #1

    How to check if all QNetworkReply of a QNetworkAccessManager is running?

    I tried like this but I get a bunch of errors:

        auto children = manager.findChildren<QNetworkReply *>();
    
        std::all_of(children.begin(), children.end(), [](auto child) {
    
        });
    
    A 1 Reply Last reply
    0
    • M Mr Gisa

      How to check if all QNetworkReply of a QNetworkAccessManager is running?

      I tried like this but I get a bunch of errors:

          auto children = manager.findChildren<QNetworkReply *>();
      
          std::all_of(children.begin(), children.end(), [](auto child) {
      
          });
      
      A Offline
      A Offline
      ambershark
      wrote on last edited by
      #2

      @Mr-Gisa Going to assume (since I'm not sure) that QNetworkReply * are parented to the QNetworkAccessManager. In which case findChildren will work ... if that assumption is correct here is how you would do it:

      foreach (QNetworkReply *reply, manager.findChildren<QNetworkReply *>())
      {
         if (reply->isRunning())
         {
            // this request is still running, do whatever you want here
         }
      }
      

      My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

      1 Reply Last reply
      1
      • M Offline
        M Offline
        Mr Gisa
        wrote on last edited by Mr Gisa
        #3

        I solved it by doing:

        auto replies = manager.findChildren<QNetworkReply *>();
        auto running = std::all_of(replies.begin(), replies.end(), [](auto child) {
            return child->isRunning();
        });
        
        1 Reply Last reply
        1

        • Login

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