Results 1 to 9 of 9

Thread: QNetworkAccesManager (Connect not emiting signal)

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2013
    Posts
    4
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QNetworkAccesManager (Connect not emiting signal)

    Hi I finally got it working.

    I added QEventLoop

    Qt Code:
    1. QNetworkAccessManager *manager = new QNetworkAccessManager(this);
    2.  
    3. QObject::connect(manager,SIGNAL(QNetworkAccessManager::finished(QNetworkReply*)),this,SLOT(replyFinish(QNetworkReply*)));
    4.  
    5. manager->get(QNetworkRequest(url));
    6.  
    7. loop.exec();
    To copy to clipboard, switch view to plain text mode 

    I am really curious how this worked ?

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts

    Default Re: QNetworkAccesManager (Connect not emiting signal)

    QNetworkAccessManager, like most of Qt's I/O classes, works asynchronous, event loop based.

    Usually that event loops comes from the Qt application object created in main().
    If you had to add an explicit event loop you are probably missing that object or you forgot to call its exec() method or you have that code in a thread and forgot to call its exec() method, ...

    And there should be no "QNetworkAccessManager::" in the SIGNAL() macro, only the name of signal and its argument types.

    Cheers,
    _

Similar Threads

  1. problem with emiting a signal
    By msmihai in forum Newbie
    Replies: 2
    Last Post: 3rd January 2009, 15:32
  2. QDateEdit emiting signal problem
    By anafor2004 in forum Newbie
    Replies: 1
    Last Post: 17th June 2008, 08:59
  3. not emiting signal
    By bisz in forum Newbie
    Replies: 4
    Last Post: 3rd October 2007, 08:49
  4. Problem emiting signal in QTreeWidgetItem's subclass
    By Shawn in forum Qt Programming
    Replies: 12
    Last Post: 4th September 2007, 13:08
  5. Emiting signal, which NOT connected to any slots
    By krivenok in forum Qt Programming
    Replies: 7
    Last Post: 27th February 2006, 17:32

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.