Results 1 to 9 of 9

Thread: Getting data from a QNetworkReply

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2012
    Posts
    47
    Thanks
    5
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default Getting data from a QNetworkReply

    That is very long and intimidating.
    Anyway, I got setcookiesforUrl() and cookiesforUrl() done without that.



    But I don't want to use global variable and my read all data is in another function.
    I want to return it like this :
    Qt Code:
    1. QByteArray data = emit finished(QNetworkReply*);
    2. connect(loginnam, finished(...), this, readdata(...);
    3. QByteArray readdata()
    4. {
    5. reply->readall.....
    6. }
    7. //Want to return slot values
    To copy to clipboard, switch view to plain text mode 
    Qt Code:
    1. //This code below is the same cause can't get the return value
    2. //In case someone said you can't emit finished or what lol
    3. connect (loginnam, finished(), this, getdata())
    4. QByteArray MainWindow::getdata()
    5. {
    6. //Emit here
    7. QByteArray returnvalue = emit readdata();
    8. return returnvalue;
    9. }
    10. QByteArray readdata()
    11. {
    12. reply->readall.....
    13. }
    To copy to clipboard, switch view to plain text mode 
    There's no finished signal except using connect with sender as qnetworkaccessmanager object. So I can't use emit finished......
    Is there any solutions to return the slot value with signal as finished? Other than private variables


    It's unnecessary question cause I have two global variable to be used globally already, but I would like to know how to do it.
    Last edited by ttimt; 2nd March 2014 at 16:39.
    I'm a newbie. Don't trust me

Similar Threads

  1. Replies: 0
    Last Post: 5th December 2011, 20:26
  2. Replies: 2
    Last Post: 14th August 2011, 05:47
  3. QNetworkReply: how to know when data is sent?
    By mentalmushroom in forum Qt Programming
    Replies: 17
    Last Post: 24th June 2011, 08:22
  4. Replies: 1
    Last Post: 8th March 2011, 06:27
  5. When to delete QNetworkReply?
    By QPlace in forum Qt Programming
    Replies: 5
    Last Post: 11th February 2009, 12:46

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.