PDA

View Full Version : QProgressBar doesn't increment!!



riskio
16th September 2011, 09:57
Hi to all!
I am developing an application that has the possibility to download a file from a LAN.

The problem is that i can t figure it out why the progress bar doesn't increment!! i made some experiments without success!!
i found an article that explains exactly what i need but the code doesn't work (even copy & paste) ! (http://www.thinking-man.com/blog/entry.php?15-Using-QNetworkAccessManager-to-Download-Files-with-a-Progress-Dialog)
I can t show my own code so please refer to the code on the site above..

i think the problem is that progressbar doesn't know the dimension of the remote file so it can t calculate the total amount of space required and finally it can t set the maximum Value with setMaximum....

Someone can help pls?

Thanks!

wysota
16th September 2011, 10:07
Make sure you are not blocking the event loop and that the loop is running.

nish
16th September 2011, 10:32
if you cant do setMaximum then it wont progress ofcourse

riskio
16th September 2011, 10:37
if you cant do setMaximum then it wont progress ofcourse

yes! i thought the same! so the next question is : how do i know the size of a remote file? obviously that size is not constant in time.
today it could be 1 MB and the day after 1.2MB and so on...

thanks for the answers

wysota
16th September 2011, 11:25
QNetworkReply::downloadProgress()

riskio
16th September 2011, 12:02
QNetworkReply::downloadProgress()

i used it! and if i print the two parameters : the first one it s ok! the second one is -1. The second one corresponds to the total bytes should be downloaded.

other suggestions?

thanks!

squidge
16th September 2011, 12:57
Sometimes its not possible to know the size of the file to be downloaded.

In these cases, use a indeterminate progress bar.