我正在使用QNetworkAccessManager从服务器发送POST,PUT和GET数据。代码如下所示。
QNetworkAccessManager *manager = new QNetworkAccessManager(this);
connect(manager, SIGNAL(proxyAuthenticationRequired(const QNetworkProxy &, QAuthenticator *)),
SLOT(slotProxyAuthenticationRequired(const QNetworkProxy &, QAuthenticator *)));
connect(manager, SIGNAL(authenticationRequired(QNetworkReply *, QAuthenticator *)),
SLOT(slotAuthenticationRequired(QNetworkReply *, QAuthenticator *)));
QNetworkRequest request;
request.setUrl(m_url);
request.setRawHeader("User-Agent", "Qt NetworkAccess 1.3");
m_pReply = manager->get(request);
m_pReply = manager->post(request,"name=someName");
m_pReply = manager->put(request,"name=someName");
我无法找到请求的任何删除方法。是的,我找到了manager-> deleteResource(request)
但是有没有
manager->delete(request,"name=someName")
Qt中的方法?或者是否存在基于例如姓名删除数据的其他方法?
答案 0 :(得分:2)
由于delete
是C ++中的保留字,因此QNetworkAccessManager
的相应方法称为deleteResource
。
http://qt-project.org/doc/qt-5.0/qtnetwork/qnetworkaccessmanager.html#deleteResource