title: Qt Download File - QNetworkAccessManager, not getting data
body: <p>I'm trying to have my application download a file from a URL, typically an EXE or a Jar, not that this should change much though. I have this all running in a thread, but I don't think that will make a difference (if it does let me know). </p>
  
  <p>So Do_Download is my function that creates the manager, sets the URL and request, and performs get. I then try to connect the finished signal to the slot the will write the file.</p>
  
  <pre><code>void DownloadManager::Do_Download() {
      QNetworkAccessManager *netManager = new QNetworkAccessManager(this);
      QUrl url(install_mirror); //istall_mirror is the URL provided by user
      QNetworkRequest req(url);
  
      QNetworkReply *reply = netManager-&gt;get(req);
  
      connect(reply, SIGNAL(finished()), this, SLOT(writeData()));
  }
  </code></pre>
  
  <p>My writeData function checks for errors, and if there are no errors it writes the data to file.</p>
  
  <pre><code>void DownloadManager::writeData() {
      QNetworkReply *reply = qobject_cast&lt;QNetworkReply*&gt;(sender());
  
      if (reply) {
          if (reply-&gt;error() == QNetworkReply::NoError) {
              QFile file(location);
              if(file.open(QIODevice::WriteOnly)) {
                      file.write(reply-&gt;readAll());
              } else {
                  errorMessage = "Error writing downloaded file for mirror installation";
              }
          } else {
              //get http status code
              int httpStatus = reply-&gt;attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
              errorMessage = "HTTP Error code while downloading from mirror: " + httpStatus;
          }
  
          reply-&gt;deleteLater();
      } else {
          errorMessage = "Error downloading file from installation mirror";
      }
  }
  </code></pre>
  
  <p>The problem being there is no data being written. It just creates a 0Kb file. 
  I tried adding a download progress slot so I could see what was going on recieving the data. So I added this to my Do_Download method.</p>
  
  <pre><code>connect(reply, SIGNAL(downloadProgress(qint64,qint64)), this, SLOT(DL_Progress(qint64,qint64)));
  
  void DownloadManager::DL_Progress(qint64 recieved, qint64 total) {
      std::cout &lt;&lt; recieved &lt;&lt; " / " &lt;&lt; total &lt;&lt; endl;
  }
  </code></pre>
  
  <p>The output displays one time as 0 / 01</p>
  
  <p>What am I doing wrong?</p>