class MyClass : public QObject { Q_OBJECTpublic: MyClass(QUrl(url)) : url(url){ this->manager = new QNetworkAccessManager(); QNetworkRequest request; request.setUrl(url); request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json"); QByteArray postData; postData.append("{\"email\": \"example@gmail.com\", \"password\": \"qweqwe\"}"); QNetworkReply * reply = manager->post(request, postData); QObject::connect(this->manager, SIGNAL(finished(QNetworkReply)), this, SLOT(serviceRequestFinished(QNetworkReply))); qDebug() << connect(this->manager, SIGNAL(finished(QNetworkReply)), this, SLOT(requestGet(QNetworkReply))); }public slots : void requestGet(QNetworkReply* reply) { ********** } }private: QNetworkAccessManager * manager; QUrl url;};
MyClass * point = new MyClass;