gpt4 book ai didi

c++ - 如何访问 QNetworkReply->readAll()?

转载 作者:行者123 更新时间:2023-11-30 03:19:52 25 4
gpt4 key购买 nike

<分区>

我正在通过 QNetwork 访问管理器发出一个简单的获取请求,我在以下函数中发送请求(管理器在构造函数中启动)。

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*)));


}

并尝试在下面的函数中接收

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");
}

但是reply->readAll()会触发下面的错误

error: member access into incomplete type 'QNetworkReply'

为什么我无法访问成员函数?

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com