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. When qnetworkreply is delete after request from QNetworkAccessManager::get(QNetworkRequest request (url))?

When qnetworkreply is delete after request from QNetworkAccessManager::get(QNetworkRequest request (url))?

Scheduled Pinned Locked Moved Solved General and Desktop
qnetworkreplyqnetworkaccessmqnetworkrequestqnetwork
2 Posts 2 Posters 430 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.
  • Y Offline
    Y Offline
    Yash001
    wrote on 7 Nov 2019, 19:09 last edited by Yash001 11 Jul 2019, 19:10
    #1

    I am accessing the network using QNetworkRequest , QNetworkAccessManager, and QNetworkReply.

    At which place m_reply delete? it will delete when manager delete or it will delete at any other place?

    QNetworkAccessManager* manager = new QNetworkAccessManager();
    auto  m_reply = manager ->get(QNetworkRequest request (https://www.google.com));
    
    // Here  read all the data from m_reply and call m_reply->close();
    
    // again use same manage for request data 
    m_reply = manager ->get(QNetworkRequest request (https://www.facebook.com));
    
    

    Can I use m_reply variable in this way?

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 7 Nov 2019, 19:31 last edited by
      #2

      Hi,

      Usually you don't store the reply but rather connect its signals to lambdas, do the processing there and then call deleteLater on it once you are done.

      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
      2

      2/2

      7 Nov 2019, 19:31

      • Login

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