This is how it should look like
Sorry but I don't have any idea how to solve this problem.
CodePudding user response:
Visual part can be handled as explained by @iam_peter.
CodePudding user response:
There is insufficient information to do this in QML
alone. I checked the XMLHttpRequest
, but the onprogress
signal doesn't seem to fire. So there doesn't appear to be a way with that component.
Alternatively, you can implement your own with QNetworkAccessManager
, QNetworkRequest
and watch for the events in QNetworkReply
. This was hinted by @Ľubomír-carik.
If you're uploading and downloading, then there are two signals of interest:
- https://doc.qt.io/qt-6/qnetworkreply.html#uploadProgress
- https://doc.qt.io/qt-6/qnetworkreply.html#downloadProgress
It will be up to you to combine the results from these signals, e.g. you can assume 50% of the time is spent in uploading your payload and 50% of the time is spent in downloading your response.
It will be up to you how to calculate a single progress
by combining the information above. Then you can feed it into a progress bar.
However, as @@Ľubomír-carik indicated not all requests are required to populate Content-Length
for which how the downloadProgress is given. If Content-Length
is not available, the information from downloadProgress is equivalent to non-determinate. So, you could either (1) leave the download progress stuck at 50% and jump to 100% when it's complete or (2) have an animation during the indeterminate download phase.