Results 1 to 3 of 3

Thread: signals not conecting...

  1. #1
    Join Date
    Jun 2009
    Posts
    37
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default signals not conecting...

    Hi Volks,
    I'm trying to connect some http signals... obviously, as all good newbies, it doesn't work...

    Here is my class declaration

    Qt Code:
    1. #include <Qt/qfile.h>
    2. #include <QtNetwork/QHttp>
    3. class ciao : public QObject
    4. {
    5. Q_OBJECT
    6.  
    7. public:
    8. ciao();
    9. ~ciao();
    10.  
    11. void Run();
    12. void tryFinished( int id, bool error );
    13. void tryReadProgress( int id, int total );
    14.  
    15. private:
    16. QFile myFile;
    17. QHttp *http;
    18. };
    To copy to clipboard, switch view to plain text mode 

    And here is what I'm doing in my constructor

    Qt Code:
    1. http = new QHttp(this);
    2. myFile.setFileName("something.txt");
    3.  
    4. bool result;
    5. result = connect(http, SIGNAL(requestFinished(int, bool)),
    6. this, SLOT(tryFinished(int, bool)));
    7. result = connect(http, SIGNAL(dataReadProgress(int, int)),
    8. this, SLOT(tryReadProgress(int, int)));
    To copy to clipboard, switch view to plain text mode 

    But... result is alway false. It sounds like connect does not recognize my methods to be valid.

    Where I'm doing wrong???????

  2. #2
    Join Date
    Sep 2008
    Location
    Bangalore
    Posts
    659
    Thanks
    116
    Thanked 42 Times in 41 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: signals not conecting...

    is it printing in the console like
    Object::connect: No such signal ....
    or it giving error while making
    "Behind every great fortune lies a crime" - Balzac

  3. #3
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,042
    Thanks
    8
    Thanked 133 Times in 128 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: signals not conecting...

    you have forgotten the "slots:"

    Qt Code:
    1. #include <Qt/qfile.h>
    2. #include <QtNetwork/QHttp>
    3. class ciao : public QObject
    4. {
    5. Q_OBJECT
    6.  
    7. public:
    8. ciao();
    9. ~ciao();
    10.  
    11. void Run();
    12. public slots://LOOK HERE
    13. void tryFinished( int id, bool error );
    14. void tryReadProgress( int id, int total );
    15.  
    16. private:
    17. QFile myFile;
    18. QHttp *http;
    19. };
    To copy to clipboard, switch view to plain text mode 

    everything else is fine

  4. The following user says thank you to nish for this useful post:

    JoZCaVaLLo (31st July 2009)

Similar Threads

  1. QStateMachine and signals
    By rossm in forum Qt Programming
    Replies: 2
    Last Post: 26th March 2009, 10:43
  2. Signals are delayed on X11?
    By Cruz in forum Qt Programming
    Replies: 13
    Last Post: 18th February 2009, 12:59
  3. Signals and Slots
    By 83.manish in forum Qt Programming
    Replies: 3
    Last Post: 30th June 2008, 10:31
  4. QThread and signals (linux/UNIX signals not Qt Signals)
    By Micawber in forum Qt Programming
    Replies: 1
    Last Post: 28th November 2007, 22:18
  5. KDE Signals
    By chombium in forum KDE Forum
    Replies: 1
    Last Post: 25th January 2006, 18:45

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.