summaryrefslogtreecommitdiffstats
path: root/src/network/access
diff options
context:
space:
mode:
authorJuha Vuolle <juha.vuolle@qt.io>2023-08-07 13:47:01 +0300
committerJuha Vuolle <juha.vuolle@qt.io>2023-12-08 15:53:34 +0200
commit298d5a4bbd3d5f68034c5419f1b80e4535a5c6f5 (patch)
treebf1ee6ee86ce3869b07c728b6f35d50da52fe8a2 /src/network/access
parente9f703ed3b5ff8a9987c6c4e3b658b41244919e3 (diff)
Add uploadProgress signal for QRestReply
Task-number: QTBUG-114717 Change-Id: I2052e4cc4da90962483f5f1931dc20552e484e34 Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Diffstat (limited to 'src/network/access')
-rw-r--r--src/network/access/qrestreply.cpp23
-rw-r--r--src/network/access/qrestreply.h1
2 files changed, 23 insertions, 1 deletions
diff --git a/src/network/access/qrestreply.cpp b/src/network/access/qrestreply.cpp
index 7770737759..82be72d2d4 100644
--- a/src/network/access/qrestreply.cpp
+++ b/src/network/access/qrestreply.cpp
@@ -57,7 +57,24 @@ Q_DECLARE_LOGGING_CATEGORY(lcQrest)
See \l QNetworkReply::downloadProgress() documentation for more details.
- \sa bytesAvailable(), readyRead()
+ \sa bytesAvailable(), readyRead(), uploadProgress()
+*/
+
+/*!
+ \fn void QRestReply::uploadProgress(qint64 bytesSent, qint64 bytesTotal,
+ QRestReply* reply)
+
+ This signal is emitted to indicate the progress of the upload part of
+ \a reply.
+
+ The \a bytesSent parameter indicates the number of bytes already uploaded,
+ while \a bytesTotal indicates the total number of bytes still to upload.
+
+ If the number of bytes to upload is not known, \a bytesTotal will be -1.
+
+ See \l QNetworkReply::uploadProgress() documentation for more details.
+
+ \sa QNetworkReply::uploadProgress(), downloadProgress()
*/
/*!
@@ -98,6 +115,10 @@ QRestReply::QRestReply(QNetworkReply *reply, QObject *parent)
[this](qint64 bytesReceived, qint64 bytesTotal) {
emit downloadProgress(bytesReceived, bytesTotal, this);
});
+ QObject::connect(reply, &QNetworkReply::uploadProgress, this,
+ [this] (qint64 bytesSent, qint64 bytesTotal) {
+ emit uploadProgress(bytesSent, bytesTotal, this);
+ });
}
/*!
diff --git a/src/network/access/qrestreply.h b/src/network/access/qrestreply.h
index 91e8d17cc3..eb547f9b5d 100644
--- a/src/network/access/qrestreply.h
+++ b/src/network/access/qrestreply.h
@@ -45,6 +45,7 @@ Q_SIGNALS:
void errorOccurred(QRestReply *reply);
void readyRead(QRestReply *reply);
void downloadProgress(qint64 bytesReceived, qint64 bytesTotal, QRestReply *reply);
+ void uploadProgress(qint64 bytesSent, qint64 bytesTotal, QRestReply* reply);
private:
friend class QRestAccessManagerPrivate;