Hello Folks,

I've a strange problem with QNetworkAccessManager, I read the documentation, but it doesn't work. My example hast only a few lines of code, so its really easy to follow it. I'm using Qt-4.8.1 under Ubuntu 11.10. At the internet I found some articles with the same issue but no solutions... so I'm posting here now.

Qt Code:
  1. void TmdbLookup::movieLookup()
  2. {
  3. bool ok = false;
  4. QNetworkRequest request;
  5. request.setUrl(QUrl("http://qt.nokia.com"));
  6. manager_ = new QNetworkAccessManager(this);
  7.  
  8. ok = connect(manager_, SIGNAL(finished(QNetworkReply*)), this, SLOT(replyFinished(QNetworkReply*)));
  9. qDebug() << "connect: " << ok;
  10. manager_->get(request);
  11. }
  12.  
  13. void TmdbLookup::replyFinished(QNetworkReply *reply)
  14. {
  15. qDebug() << "Request Finished";
  16. reply->deleteLater();
  17. }
To copy to clipboard, switch view to plain text mode 

The problem I've is the finished(QNetworkReply*) singal is never emitted, but the connect returns true. I never had any problems with signal / slots in qt. But the QNetworkAccessManager will not work and I can't find an other Example or a solution.

In my second try I'll connect the finish() signal not to the QNetworkAccessManager. I'll connect it directly to the QNetworkReply.

Qt Code:
  1. void TmdbLookup::movieLookup()
  2. {
  3. bool ok = false;
  4. QNetworkRequest request;
  5. request.setUrl(QUrl("http://qt.nokia.com"));
  6. manager_ = new QNetworkAccessManager(this);
  7.  
  8. ok = connect(manager_, SIGNAL(finished(QNetworkReply*)), this, SLOT(replyFinished(QNetworkReply*)));
  9. QNetworkReply *reply = manager_->get(request);
  10. ok = connect(reply, SIGNAL(finished()), this, SLOT(readyRead()));
  11. qDebug() << "connect: " << ok;
  12. }
  13.  
  14. void TmdbLookup::readyRead()
  15. {
  16. qDebug() << "ready read";
  17. }
To copy to clipboard, switch view to plain text mode 

The finished() signal is not emitted.

Can someone help me to solve my problem? I'm really confused, in these small examples there is no space for mistakes so what I'm doing wrong?

so long
realperson