Results 1 to 4 of 4

Thread: Signals and Slots and HTTP

  1. #1
    Join Date
    Nov 2009
    Posts
    68
    Qt products
    Qt4 Qt/Embedded
    Thanks
    1
    Thanked 1 Time in 1 Post

    Default Signals and Slots and HTTP

    I am getting this error when I run my code:

    URL.Host = edition.cnn.com
    URL.Path = /services/podcasting/newscast/rss.xml
    Object::connect: No such slot PodcastFeed::FeedReadData(const QHttpResponseHeader &) in podcastfeed.cpp:25
    Object::connect: No such slot PodcastFeed::FeedRequestFinished( int, bool) in podcastfeed.cpp:26
    ConnectionId = 2
    (Internal error: pc 0x6241a0 in read in psymtab, but not in symtab.)
    (Internal error: pc 0x6241a0 in read in psymtab, but not in symtab.)
    (Internal error: pc 0x6241a1 in read in psymtab, but not in symtab.)
    (Internal error: pc 0x6241a0 in read in psymtab, but not in symtab.)
    (Internal error: pc 0x6241a0 in read in psymtab, but not in symtab.)

    Can someone give me a hand I am using QTCreator and QT 4.6.

    Here is my header:

    Qt Code:
    1. #ifndef PODCASTFEED_H
    2. #define PODCASTFEED_H
    3. #include <QObject>
    4. #include <QString>
    5. #include <QtNetwork>
    6. #include <QHttp>
    7.  
    8. class PodcastFeed : public QObject
    9. {
    10. Q_OBJECT
    11.  
    12. public:
    13. PodcastFeed();
    14. int id;
    15. QString title;
    16. QString description;
    17. QString url;
    18. QString action;
    19. int actionInt;
    20. int sortOrder;
    21.  
    22. QString feedTitle;
    23. QString feedDescription;
    24.  
    25. void Load();
    26. void DownloadFeed(QString url);
    27. void FeedReadData(const QHttpResponseHeader &resp);
    28. void FeedRequestFinished( int id, bool error);
    29.  
    30.  
    31.  
    32. private:
    33. bool completed;
    34. int connectionId;
    35. QHttp http;
    36. QXmlStreamReader xml;
    37. void ParseXml();
    38. };
    39. #endif // PODCASTFEED_H
    To copy to clipboard, switch view to plain text mode 

    and here is the function I am having difficulty with.

    Qt Code:
    1. void PodcastFeed::DownloadFeed(QString url)
    2. {
    3. xml.clear();
    4. QUrl myUrl(url);
    5. http.setHost(myUrl.host());
    6. Util::WriteLine("URL.Host = " + myUrl.host());
    7. Util::WriteLine("URL.Path = " + myUrl.path());
    8.  
    9. QObject::connect(&http, SIGNAL(readyRead(const QHttpResponseHeader &)), this, SLOT(FeedReadData(const QHttpResponseHeader &)));
    10. QObject::connect(&http, SIGNAL(requestFinished( int, bool)), this, SLOT(FeedRequestFinished( int, bool)));
    11. connectionId = http.get(myUrl.path());
    12. Util::WriteLine("ConnectionId = " + QString::number(connectionId));
    13. // Proceeds to FeedReadData when read.
    14. }
    15.  
    16. void PodcastFeed::FeedRequestFinished( int id, bool error)
    17. {
    18. Util::WriteLine("GotRequestFinished");
    19. }
    20.  
    21. void PodcastFeed::FeedReadData(const QHttpResponseHeader &resp)
    22. {
    23. Util::WriteLine("FeedReadData");
    24. if (resp.statusCode() != 200)
    25. http.abort();
    26. else {
    27. xml.addData(http.readAll());
    28. ParseXml();
    29. }
    30. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    6
    Thanked 348 Times in 333 Posts

    Default Re: Signals and Slots and HTTP

    I don't see how much plainer the error could be. It telling you that you have no such slot FeedReadData & FeedRequestFinished, which is absolutely correct, as you don't.

    If the ones with the same name in your class are meant to be slots, then you need to describe them as such by using the "slots" keyword.

    Qt Code:
    1. slots:
    2. void FeedReadData(const QHttpResponseHeader &resp);
    3. void FeedRequestFinished( int id, bool error);
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Nov 2009
    Posts
    68
    Qt products
    Qt4 Qt/Embedded
    Thanks
    1
    Thanked 1 Time in 1 Post

    Default Re: Signals and Slots and HTTP

    Thanks, I missed this. I am new to QT.

  4. #4
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    6
    Thanked 348 Times in 333 Posts

    Default Re: Signals and Slots and HTTP

    If your new to Qt (It's Qt, not QT, as it's not an abbreviation), then you should really be posting in the "Newbie" section, not the "more advanced Qt" section.

Similar Threads

  1. http request without signals and slots
    By whites11 in forum Newbie
    Replies: 6
    Last Post: 7th January 2010, 16:39
  2. about signals and slots
    By Sandip in forum Qt Programming
    Replies: 9
    Last Post: 15th July 2008, 16:02
  3. Signals and Slots
    By 83.manish in forum Qt Programming
    Replies: 3
    Last Post: 30th June 2008, 10:31
  4. regarding signals/slots
    By jjbabu in forum Qt Programming
    Replies: 2
    Last Post: 4th October 2007, 09:32
  5. help with signals and slots
    By superutsav in forum Qt Programming
    Replies: 3
    Last Post: 4th May 2006, 12:49

Tags for this Thread

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.