Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QNetworkReply doesn't emit the signal finished()

QNetworkReply doesn't emit the signal finished()

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    b1gsnak3
    wrote on last edited by
    #1

    Hello. I have this code:

    @MyYoutubeClass::MyYoutubeClass(QObject *parent) :
    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.1875.8.6.0.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 ^^)
    Windows 7

    1 Reply Last reply
    0
    • T Offline
      T Offline
      tilsitt
      wrote on last edited by
      #2

      Hi,

      what is the result of isFinished() on your reply (before the connect)?

      1 Reply Last reply
      0
      • B Offline
        B Offline
        b1gsnak3
        wrote on last edited by
        #3

        false... but why? because it loads in the WebView...

        1 Reply Last reply
        0
        • T Offline
          T Offline
          tilsitt
          wrote on last edited by
          #4

          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 :( .

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved