QProgressBar problem with uploading
- by rolanddd
Hey all!
I show my code first, then I explain my problem:
...
// somewhere in the constructor
progressBar = new QProgressBar(this);
progressBar-setMinimum(0);
progressBar-setMaximum(100);
...
connect(&http, SIGNAL(dataSendProgress(int, int)), this, SLOT(updateProgressBar(int, int)));
...
void MainWindow::updateProgressBar(int bytesSent, int total)
{
progressBar-setMaximum(total);
progressBar-setValue(bytesSent);
}
So this is how I try to make my progressBar being updated when I upload a file. The problem is, it won't do the job. When it starts uploading, I set the value of the progress bar to 0, then (thanks to this slot) it won't actually show the progress, but will jump to 100% immediately (even before it finished uploading).
I already checked the HTTP Client example, and copied the progress bar part, it is for downloading, and more or less is the same as for uploading but it uses the dataReadProgress signal (needed for downloading) AND it works perfectly.
Does anybody know how to solve this for uploading?