PDA

View Full Version : connecting Qhttp::datareadprogress to progressbar



k.qasempour
6th June 2012, 12:02
hi all. im writing an application which has to download an html page via http. its completly work..
but i have to connect a progress bar to show the progress. here is the code.... i added some code but it dosent work... give me an example plz... thnx alot



void MainWindow::readWebPage(bool aError)
{

QByteArray myByteArray;
myByteArray = myHttp.readAll();
ui->textEdit->append(myByteArray);

}

void MainWindow::LoadWebPage()
{

myHttp.setHost("matnbaz.com",80);
myHttp.get("/proxy.php");

connect(&myHttp,SIGNAL(dataReadProgress(done,total)),
ui->progressBar,SLOT(setMaximum(total)));

connect(&myHttp,SIGNAL(dataReadProgress(done,total)),
ui->progressBar,SLOT(setValue(done)));

connect(&myHttp, SIGNAL(done(bool)),this , SLOT(readWebPage(bool)));

}