QNetworkReply doesn't emit the signal finished()
Hello. I have this code:
@MyYoutubeClass::MyYoutubeClass(QObject *parent) :
QNetworkAccessManager netAM; webView = new QWebView(); std::cout << "access manager created" << std::endl; QNetworkRequest request; std::cout << "request created" << std::endl; QString searchString = "christmas"; request.setUrl(QUrl("http://www.youtube.com/results?search_query=" + searchString + "&oq=" + searchString + "&gs_l=youtube.3..0l10.517.964.0.18188.8.131.52.0.0.0.196.891.0j6.6.0...0.0...1ac.1.IHtHOivIUgg")); std::cout << "request url set" << std::endl; QNetworkReply *reply = netAM.get(request); connect(reply, SIGNAL(finished()), this, SLOT(processReply()));
For some reason, the signal is not emited. Anyone knows why?
Thank you in advance.
If I put the reply url in a webview it shows it correctly. However I need to parse the reply content not just show it.
Qt 4.8.4 MinGW (untill I get the trial for Qt5 ^^)
what is the result of isFinished() on your reply (before the connect)?
false... but why? because it loads in the WebView...
Ok. I wanted to see if the reply wasn't finished before your connect (so the signal would be emitted before being connected to your slot). Maybe you can try "QNetworkAccessManager::finished()":http://qt-project.org/doc/qt-4.8/qnetworkaccessmanager.html#finished instead of QNetworkReply signal. I am not sure it will change anything, but I have no other idea :( .