I am making a simple get request via the QNetwork access manager, I send the request in the following function (the manager is initiated in the constructor).
void ui_screen::check_api_authenciation(const QString& access_token) {
//construct the api url
QUrl api_validation_url(this->API_VALIDATION_URL);
QNetworkRequest api_validation_request(api_validation_url);
api_validation_request.setHeader(QNetworkRequest::ServerHeader, "Authorization: token " + access_token);
mgr->get(api_validation_request);
connect(mgr, SIGNAL(finished(QNetworkReply*)), this, SLOT(on_authenciation_response_arrive(QNetworkReply*)));
}
and try to receive in the following function
void ui_screen::on_authenciation_response_arrive(QNetworkReply* reply) {
QByteArray bts = reply->readAll();
QString str(bts);
ui->authenciation_progress->setRange(0,100);
ui->authenciation_progress->setValue(100);
ui->authenciation_progress_label->setText("Reply arrived");
}
but reply->readAll()
triggers the following error
error: member access into incomplete type 'QNetworkReply'
Why couldn't I access the member function?
This error is raised if you're missing some include files.
You can include the declaration from header file for the QNetworkReply
class that will "complete" the type by adding
#include <QNetworkReply>
at the top of your file.