我想使用此代码将数据发布到PHP表单,但在编译之后我有消息:
Object :: connect:没有这样的信号NetworkReplyImpl :: finished(QNetworkReply *):
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent)
{
QUrl params;
QUrl url("localhost/test2.php");
params.addQueryItem("name","aaa");
params.addQueryItem("country","bbb");
QByteArray data;
data.append(params.toString());
data.remove(0,1);
QNetworkAccessManager *manager = new QNetworkAccessManager(this);
QNetworkReply *reply = manager->post(QNetworkRequest(url), data);
connect(reply, SIGNAL(finished(QNetworkReply*)), this,SLOT(replyFinished(QNetworkReply*)));
}
MainWindow::~MainWindow()
{
}
void MainWindow::replyFinished(QNetworkReply *reply)
{
QString data = reply->readAll().trimmed();
qDebug() << data;
}
答案 0 :(得分:2)
该消息非常清楚:QNetworkReply
没有信号finished(QNetworkReply*)
。但它确实有一个信号finished()
,它不带任何参数。你不能这样回复。