PDA

View Full Version : QProgressDialog and Network donwload



Momergil
7th March 2012, 18:35
Hello!

I need to implement a QProgressDialog to show the download from the web, and for that I'm using QNetworkAcessManager + QNetworkReply.

The problem is that as far as I know, in order for the QProgressDialog to work properly, I need to set the minimum and maximum value, i.e. 0 bytes and the size of the file I'll be downloading, which is not predefined. I tried to find functions in the network classes that could show me the size of the file I'm downloading before start it, but I didn't, and despite I can use the value shown in the signal downloadProgress(qint64,qint64), I don't want to use this way (i.e. I want to start the progress dialog already with the maxium value set). Given the fact that the signal shows the size of the file, how can I find that information?

Obs.: I'm downloading the file from a url.


Thanks,

Momergil

wysota
7th March 2012, 18:43
In a general case you can't know the size of the download before you start downloading as the size is reported by the server in response headers for the request.

Momergil
7th March 2012, 19:05
In a general case you can't know the size of the download before you start downloading as the size is reported by the server in response headers for the request.

Hmm, in which case I'll have to continue as it is.


OK, than; at least it's working.


Thanks,


Momergil