hai,
void HttpPost::on_pushButton_clicked()
{
params.addQueryItem("testSample","indu");
postData = params.encodedQuery();
manager->setCookieJar(new QNetworkCookieJar(manager));
connect (manager, SIGNAL(finished(QNetworkReply *)), this, SLOT(replyFinish(QNetworkReply*)));
manager->post(req, postData);
}
void HttpPost::on_pushButton_clicked()
{
params.addQueryItem("testSample","indu");
postData = params.encodedQuery();
manager->setCookieJar(new QNetworkCookieJar(manager));
connect (manager, SIGNAL(finished(QNetworkReply *)), this, SLOT(replyFinish(QNetworkReply*)));
manager->post(req, postData);
}
To copy to clipboard, switch view to plain text mode
void HttpPost::replyFinish(QNetworkReply* reply)
{
qDebug() << "answer------------>"<<answer;
}
void HttpPost::replyFinish(QNetworkReply* reply)
{
QString answer = QString::fromUtf8(reply->readAll());
qDebug() << "answer------------>"<<answer;
}
To copy to clipboard, switch view to plain text mode
This code is working for me but i don't want to use the "connect" here. I want the reply in the same function. I used
if (reply->isFinished()==true) but it doesnt work
How to wait until the request has finished and then process the reply within one function
Bookmarks