Results 1 to 8 of 8

Thread: QNetworkAccessManager::get() problem

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jun 2008
    Posts
    64
    Thanks
    7
    Qt products
    Qt3 Qt4

    Default Re: QNetworkAccessManager::get() problem

    I am a bit confused.
    How can I call the quit() or exit without the object? Where to quit? Inside the slot?

    What I have now is something like:
    Qt Code:
    1. void Report::test()
    2. {
    3.  
    4. QNetworkAccessManager * manager = new QNetworkAccessManager();
    5. QNetworkConfigurationManager config_manager;
    6. manager->setConfiguration(config_manager.defaultConfiguration());
    7. connect( manager, SIGNAL( finished( QNetworkReply* ) ), this, SLOT( webReportGenerateFinished(QNetworkReply*) ));
    8. QNetworkReply *reply = manager->get(QNetworkRequest(QUrl("http://192.168.0.199/webreport/shift.php?title=ShiftReport&fromdate=2012-01-03&todate=2012-01-03&shift[]=2&emp[]=1&stationNo=1&lang=1&format=1&rounddp=1")));
    9.  
    10. loop.exec()
    11. }
    12.  
    13. void Report::webReportGenerateFinished(QNetworkReply* reply)
    14. {
    15. cout<<"RM generate finished!"<<endl;
    16. ..
    17. ..
    18. ..// call loop.quit() here??? Do not have the loop object actually....
    19.  
    20. qDebug("RM generate finished!");
    21. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: QNetworkAccessManager::get() problem

    QEventLoop::quit() is a slot... connect something to it, or change the scope of the QEventLoop.

    Better still, identify the flaw in your original design. What are you doing after you call test() that is not allowing the normal flow of events?

  3. The following user says thank you to ChrisW67 for this useful post:

    batileon (17th January 2012)

Similar Threads

  1. Replies: 2
    Last Post: 14th September 2019, 18:43
  2. Replies: 14
    Last Post: 28th August 2011, 14:11
  3. Replies: 8
    Last Post: 19th April 2011, 07:17
  4. QNetworkAccessManager problem instantiating
    By hojoff79 in forum Qt Programming
    Replies: 8
    Last Post: 9th February 2011, 04:59
  5. qnetworkaccessmanager problem!
    By novamaster in forum Qt Programming
    Replies: 6
    Last Post: 7th August 2010, 11: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.