Results 1 to 4 of 4

Thread: QObject::connect says "no such signal"

  1. #1
    Join Date
    Oct 2006
    Posts
    6
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default QObject::connect says "no such signal"

    Hi,

    I've been trying to use a QSpinBox in my project. I would like to use the signal "valueChanged(int i)" (as described in the documentation), but at runtime QObject::connect complains that there is no such signal ;-(

    I thought that something with my code was wrong. But even the following small application is suffering the same problem:
    Qt Code:
    1. #include <QtGui>
    2. #include <QApplication>
    3.  
    4. int main(int argc, char **argv)
    5. {
    6. QApplication app(argc, argv);
    7.  
    8.  
    9. QObject::connect(
    10. &sB, SIGNAL(valueChanged(int i)),
    11. &app, SLOT(quit())
    12. );
    13.  
    14. sB.show();
    15. return app.exec();
    16. }
    To copy to clipboard, switch view to plain text mode 


    I'm using QT 4.2.0 for Windows and MingW.

    Can anyone spot the point where my mistake is? I'm really getting mad about this.

  2. #2
    Join Date
    Jan 2006
    Posts
    667
    Thanks
    10
    Thanked 80 Times in 74 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QObject::connect says "no such signal"

    try this

    Qt Code:
    1. QObject::connect(
    2. &sB, SIGNAL(valueChanged(int)),
    3. &app, SLOT(quit())
    4. );
    To copy to clipboard, switch view to plain text mode 

    In signal and slot you should only specify the variable type and not the variable name.

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

    MistaPain (30th October 2006)

  4. #3
    Join Date
    Oct 2006
    Posts
    6
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QObject::connect says "no such signal"

    Interesting. I just tried some other signals and for example QAbstractSpinBox::editingFinished() and they seem to work. QObject::destroyed() works, too, but QObject::destroyed(&something) doesn't.

    It seems that signals without parameters work, but all other fail. Can anyone reproduce this behaviour?

    edit: Oh, munna. You're right. The naming was my mistake. Thank you very much for your help. I've been struggling more than an hour now.

  5. #4
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QObject::connect says "no such signal"

    Even the
    Qt Code:
    1. SIGNAL(valueChanged(int i))
    To copy to clipboard, switch view to plain text mode 

    is working fine with me. I am using Visual C++ 6.0 with Qt 4.2.0

Similar Threads

  1. QStringList in QObject::connect
    By DPinLV in forum Qt Programming
    Replies: 6
    Last Post: 6th September 2006, 17:01

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.