tags:

views:

329

answers:

2

Hi All

I'm trying to build a module which downloads a binary file in QT, using QNetworkAccessManager. I use the same approach detailed in the documentation (see below), but while I do get readyRead signals, downloadProgress never arrives.

everything happens on the same thread (the project is big so i cannot paste it all)

any ideas? i've exhausted many, many trials - and any thought would be appreciated

thanks very much, Lior

QNetworkRequest request; request.setUrl("http://XXX.s3.amazonaws.com/XXX.exe"); request.setRawHeader("User-Agent", "MyOwnBrowser 1.0");

QNetworkAccessManager * m_manager = new QNetworkAccessManager( this ); m_reply = m_manager->get(request); m_reply->setParent(this);

connect(m_reply, SIGNAL(readyRead()), this, SLOT(slotReadyRead())); connect(m_reply, SIGNAL(downloadProgress(qint64 bytesReceived, qint64 bytesTotal)), this, SLOT(replyDownloadProgress(qint64 bytesReceived, qint64 bytesTotal)));

A: 

ok found it wow what an simple mistake.

the answer is syntactic:

connect(m_reply, SIGNAL(downloadProgress(qint64 bytesReceived, qint64 bytesTotal)), this, SLOT(replyDownloadProgress(qint64 bytesReceived, qint64 bytesTotal)));

is an error

it should be: connect(m_reply, SIGNAL(downloadProgress(qint64 , qint64 )), this, SLOT(replyDownloadProgress(qint64 , qint64 ));

once i changed it, i got the signal.

QT DOES NOT CHECK SYNTAX ERRORS IN ITS PREPROCESSOR (note to self)

Lior
You should have received an error on stderr.
Kitsune
Yeah. But those errors are easy to miss (if you output anything yourself at all)
Eugene
Kitsune: can I see stderr on Visual Studio? would that be in the Output window
Lior
Yes, look in the output window.
rpg
A: 

I've patched my Qt to use a qFatal() instead of qWarning(), so the app asserts instead of printing error messages (that cannot be seen when linking against a release-build Qt). YMMV.