[Qt-interest] QT 4.6: Strange behavior while using QNAM for multiple HTTP requests
Thiago Macieira
thiago at kde.org
Mon May 3 08:24:07 CEST 2010
Em Segunda-feira 3. Maio 2010, às 07.49.20, Mandeep Sandhu escreveu:
> <snip>
> void download() {
> for (int i=1; i<3; i++) {
> QString urlStr = QString("http://localhost/test%1.jpg").arg(i);
> qDebug() << urlStr;
>
> QNetworkRequest req;
> req.setUrl(QUrl(urlStr));
> qDebug() << "Pipelining allowed -"
> <<
> req.attribute(QNetworkRequest::HttpPipeliningAllowedAttribute).toBool();
>
> mgr->get(req);
> connect(mgr, SIGNAL(finished(QNetworkReply*)),
> this, SLOT(getData(QNetworkReply*)));
> }
> }
Note the connect() inside the for loop.
You said:
> The finished signal of QNAM is emitted TWICE for each URL,
That is incorrect. The signal is emitted only once. But the slot is called
twice because you connected the signal twice to it.
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
Senior Product Manager - Nokia, Qt Development Frameworks
PGP/GPG: 0x6EF45358; fingerprint:
E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100503/1f8f352c/attachment.bin
More information about the Qt-interest-old
mailing list