path: root/src/network/access/qnetworkreply_p.h
diff options
authorShane Kearns <>2012-05-24 16:14:28 +0100
committerQt by Nokia <>2012-06-14 05:26:35 +0200
commitd6d9c8bf3245ec3d1ff05ae45d54baac64d76cec (patch)
treea06dd484063c9ad94ad21b98241b0d1afe4d0961 /src/network/access/qnetworkreply_p.h
parent5a7937bb042a006482ed50f7b7de437e15e593ce (diff)
choke downloadProgress signals
The QNetworkReply::downloadProgress signal is intended for updating user interface components (e.g. a progress bar). Limit signal emissions to 10 times per second, with an additional signal just before the finished() signal to provide the 100% progress. For the size of download where a progress bar is necessary, this update frequency seems sufficient. The implementation is done by dropping signals which would be emitted less than 100ms after the previous signal emission. Task-number: QTBUG-20449 Change-Id: I9c2dbe16c70f3270cbf98f3c74cf9d9a3f0ab900 Reviewed-by: David Faure <> Reviewed-by: Markus Goetz <> Reviewed-by: Martin Petersson <>
Diffstat (limited to 'src/network/access/qnetworkreply_p.h')
1 files changed, 3 insertions, 0 deletions
diff --git a/src/network/access/qnetworkreply_p.h b/src/network/access/qnetworkreply_p.h
index 9c838a5539..04598fc712 100644
--- a/src/network/access/qnetworkreply_p.h
+++ b/src/network/access/qnetworkreply_p.h
@@ -57,6 +57,7 @@
#include "qnetworkrequest_p.h"
#include "qnetworkreply.h"
#include "QtCore/qpointer.h"
+#include <QtCore/QElapsedTimer>
#include "private/qiodevice_p.h"
@@ -69,6 +70,8 @@ public:
QUrl url;
QPointer<QNetworkAccessManager> manager;
qint64 readBufferMaxSize;
+ QElapsedTimer downloadProgressSignalChoke;
+ const static int progressSignalInterval;
QNetworkAccessManager::Operation operation;
QNetworkReply::NetworkError errorCode;
bool isFinished;