title: Pass QCoreApplication in parameter
body: <p>I'm tring to build a client for a web service. My goal is to <strong>send a request to my server every second</strong>. I used this library to help me : <a href="https://github.com/azadkuh/qhttp#setup" rel="nofollow noreferrer">QHttp</a></p>
  
  <p>I create a <strong>timer that I link with a signal to my <code>QCoreApplication app</code>, and send my request when the timer reach 1 second</strong>.</p>
  
  <p>Here's <strong>how I do it</strong> :</p>
  
  <p><em>main.cpp</em></p>
  
  <pre><code>#include "request.h"
  
  int main(int argc, char** argv) {
  
      QCoreApplication app(argc, argv);
      Request* request = new Request();
      request-&gt;sendRequestPeriodically(1000, app);
  
  
      return app.exec();
  }
  </code></pre>
  
  <p><em>request.h</em></p>
  
  <pre><code>//lots of include before
  class Request
  {
      Q_OBJECT
  
  public:
      Request();
      void sendRequestPeriodically (int time, QCoreApplication app);
  
  public slots:
      void sendRequest (QCoreApplication app);
  
  };
  </code></pre>
  
  <p><em>request.cpp</em></p>
  
  <pre><code>#include "request.h"
  
  void Request::sendRequest (QCoreApplication app){
      using namespace qhttp::client;
      QHttpClient client(&amp;app);
      QUrl        server("http://127.0.0.1:8080/?Clearance");
  
      client.request(qhttp::EHTTP_GET, server, [](QHttpResponse* res) {
          // response handler, called when the incoming HTTP headers are ready
  
  
          // gather HTTP response data (HTTP body)
          res-&gt;collectData();
  
          // when all data in HTTP response have been read:
          res-&gt;onEnd([res]() {
              // print the XML body of the response
              qDebug("\nreceived %d bytes of http body:\n%s\n",
                      res-&gt;collectedData().size(),
                      res-&gt;collectedData().constData()
                    );
  
              // done! now quit the application
              //qApp-&gt;quit();
          });
  
      });
  
      // set a timeout for the http connection
      client.setConnectingTimeOut(10000, []{
          qDebug("connecting to HTTP server timed out!");
          qApp-&gt;quit();
      });
  }
  
  void Request::sendRequestPeriodically(int time, QCoreApplication app){
      QTimer *timer = new QTimer(this);
      QObject::connect(timer, SIGNAL(timeout()), this, SLOT(sendRequest(app)));
      timer-&gt;start(time); //time specified in ms
  }
  
  Request::Request()
  {
  
  }
  </code></pre>
  
  <p>I got these errors : </p>
  
  <pre><code>C:\Qt\5.7\mingw53_32\include\QtCore\qcoreapplication.h:211: erreur : 'QCoreApplication::QCoreApplication(const QCoreApplication&amp;)' is private
       Q_DISABLE_COPY(QCoreApplication)
  
  C:\Users\ebelloei\Documents\qhttp\example\client-aircraft\main.cpp:7: erreur : use of deleted function 'QCoreApplication::QCoreApplication(const QCoreApplication&amp;)'
  </code></pre>
  
  <p>I'm new to Qt, but I assume this comes from the fact I can't passe my QCoreApplication in parameters, is this right ?</p>