mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 04:44:11 +02:00
Added forgotten sendCustomRequest Method + comments
This commit is contained in:
parent
6e02561d96
commit
84ea9833bb
2 changed files with 19 additions and 0 deletions
|
@ -131,3 +131,19 @@ QNetworkReply* NetworkAccessManager::put(const QNetworkRequest & request, const
|
|||
}
|
||||
return QNetworkAccessManager::put(request, data);
|
||||
}
|
||||
|
||||
|
||||
QNetworkReply* NetworkAccessManager::sendCustomRequest(const QNetworkRequest& request, const QByteArray& verb, QIODevice* data) {
|
||||
if (QThread::currentThread() != thread()) {
|
||||
QNetworkReply* result;
|
||||
QMetaObject::invokeMethod(this,
|
||||
"sendCustomRequest",
|
||||
Qt::BlockingQueuedConnection,
|
||||
Q_RETURN_ARG(QNetworkReply*, result),
|
||||
Q_ARG(const QNetworkRequest, request),
|
||||
Q_ARG(const QByteArray, verb),
|
||||
Q_ARG(QIODevice*, data));
|
||||
return result;
|
||||
}
|
||||
return QNetworkAccessManager::sendCustomRequest(request, verb, data);
|
||||
}
|
|
@ -17,6 +17,8 @@
|
|||
#include <QNetworkProxy>
|
||||
|
||||
/// Wrapper around QNetworkAccessManager wo that we only use one instance
|
||||
/// For any other method you should need, make sure to be on the right thread
|
||||
/// or call the method using QMetaObject::invokeMethod()
|
||||
class NetworkAccessManager : public QNetworkAccessManager {
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
@ -30,6 +32,7 @@ public:
|
|||
Q_INVOKABLE QNetworkReply* put(const QNetworkRequest& request, QIODevice* data);
|
||||
Q_INVOKABLE QNetworkReply* put(const QNetworkRequest& request, QHttpMultiPart* multiPart);
|
||||
Q_INVOKABLE QNetworkReply* put(const QNetworkRequest& request, const QByteArray& data);
|
||||
Q_INVOKABLE QNetworkReply* sendCustomRequest(const QNetworkRequest& request, const QByteArray& verb, QIODevice* data = 0);
|
||||
|
||||
private:
|
||||
NetworkAccessManager();
|
||||
|
|
Loading…
Reference in a new issue