PDA

View Full Version : QNetworkAccessManager downloadfile



halvors
21st April 2010, 14:56
Hi!

I want to download files from the http using QNetworkAccesmanager, my ide is making a update functon for my program.

But how can i code the downloader???

Halvor.

Lykurg
21st April 2010, 15:09
It's all in the docs. Isn't it? See detailed description of QNetworkAccessManager.

halvors
21st April 2010, 15:37
Yes, but i can understand it. Exemples please ;)

Lykurg
21st April 2010, 15:45
Exemples please ;)Then the Newbie section is more suitable for you and there is an example in the docs:
QNetworkRequest request;
request.setUrl(QUrl("http://qt.nokia.com"));
request.setRawHeader("User-Agent", "MyOwnBrowser 1.0"); // not needed

QNetworkReply *reply = manager->get(request);
connect(reply, SIGNAL(readyRead()), this, SLOT(slotReadyRead()));
connect(reply, SIGNAL(error(QNetworkReply::NetworkError)),
this, SLOT(slotError(QNetworkReply::NetworkError)));
connect(reply, SIGNAL(sslErrors(QList<QSslError>)),
this, SLOT(slotSslErrors(QList<QSslError>)));More is hardly possible, only the mention of QNetworkReply -> QIODevice::readAll().

nhs_0702
21st April 2010, 15:55
Then the Newbie section is more suitable for you and there is an example in the docs:
QNetworkRequest request;
request.setUrl(QUrl("http://qt.nokia.com"));
request.setRawHeader("User-Agent", "MyOwnBrowser 1.0"); // not needed

QNetworkReply *reply = manager->get(request);
connect(reply, SIGNAL(readyRead()), this, SLOT(slotReadyRead()));
connect(reply, SIGNAL(error(QNetworkReply::NetworkError)),
this, SLOT(slotError(QNetworkReply::NetworkError)));
connect(reply, SIGNAL(sslErrors(QList<QSslError>)),
this, SLOT(slotSslErrors(QList<QSslError>)));More is hardly possible, only the mention of QNetworkReply -> QIODevice::readAll().


i want use qhttp download part of an entry ,
can you help me and edit my source http://www.mediafire.com/?dzjaztigrnm

please read more:
http://www.qtcentre.org/threads/30062-HttpHeader-Request-only-part-of-an-entity

squidge
21st April 2010, 19:07
nhs_0702, please don't do that. It's extremely rude and bad etiquette. You have you own thread and people will reply there.

sana
10th February 2011, 08:31
nice one!!!!