Results 1 to 11 of 11

Thread: no such slot

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jun 2009
    Posts
    11
    Qt products
    Qt4
    Platforms
    Windows

    Default no such slot

    i have declared a slot in the QuarterWidget class like this:

    public slots:
    void home();

    and i tried to make the connection with the clicked() signal of a button on the GUI,
    but the connection failed and i read on the output window :

    Object::connect: No such slot SIM::Coin3D::Quarter::QuarterWidget::home().
    notice that the word "Q_OBJECT" is written at the beginning of the class QuarterWidget.

    any help ?

  2. #2
    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: no such slot

    Do you have Q_OBJECT declared in you class ? And can we see the declaration of the class ?

  3. #3
    Join Date
    Jun 2009
    Posts
    11
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: no such slot

    Qt Code:
    1. class QUARTER_DLL_API QuarterWidget : public QGLWidget
    2. {
    3. typedef QGLWidget inherited;
    4. Q_OBJECT
    5.  
    6. public:
    7. explicit QuarterWidget(QWidget * parent = 0, const QGLWidget * sharewidget = 0, Qt::WindowFlags f = 0);
    8. explicit QuarterWidget(QGLContext * context, QWidget * parent = 0, const QGLWidget * sharewidget = 0, Qt::WindowFlags f = 0);
    9. explicit QuarterWidget(const QGLFormat & format, QWidget * parent = 0, const QGLWidget * shareWidget = 0, Qt::WindowFlags f = 0);
    10. virtual ~QuarterWidget();
    11.  
    12.  
    13. public slots:
    14. void setHome(void);
    15. void home();
    16.  
    17. };
    To copy to clipboard, switch view to plain text mode 

    i tried to debug the QObject::connect() line, and i found that no slot is found.
    Last edited by eGamer; 24th June 2009 at 08:59.

  4. #4
    Join Date
    May 2009
    Posts
    62
    Thanks
    2
    Thanked 16 Times in 15 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: no such slot

    Does your build process generate a moc_quarterwidget.cpp file? If not, re-run qmake.

  5. #5
    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: no such slot

    And how do you connect ? Can we see the connect code ?
    Also did you try rebuilding the whole application ?

  6. #6
    Join Date
    Jun 2009
    Posts
    11
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: no such slot

    Quote Originally Posted by aamer4yu View Post
    And how do you connect ? Can we see the connect code ?
    Also did you try rebuilding the whole application ?
    Qt Code:
    1. QuarterWidget* viewer = new QuarterWidget();
    2. QPushButton* b = new QPushButton("CLick ME",viewer);
    3. b->setGeometry(0,0,80,40);
    4. if( !QObject::connect(b,SIGNAL(clicked()),viewer,SLOT(home())) )
    5. QMessageBox::warning(0,"Error","Failed to Connect Slots Signals");
    To copy to clipboard, switch view to plain text mode 

    also i have rebuild the whole SOLUTION.

  7. #7
    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: no such slot

    Object::connect: No such slot SIM::Coin3D::Quarter::QuarterWidget::home().
    you first posted this error. so how many classes this class is inheriting?

  8. #8
    Join Date
    Jun 2009
    Posts
    11
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: no such slot

    Quote Originally Posted by MrDeath View Post
    you first posted this error. so how many classes this class is inheriting?
    QuarterWidget only inherits from QGLWidget, but what you see is the namespaces.

  9. #9
    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: no such slot

    if all other slots of the class are working then try to rename the slot(wild guess i know). can u call this slot directly?

  10. #10
    Join Date
    Jun 2009
    Posts
    11
    Qt products
    Qt4
    Platforms
    Windows

    Smile Re: no such slot

    Quote Originally Posted by MrDeath View Post
    if all other slots of the class are working then try to rename the slot(wild guess i know). can u call this slot directly?
    no your advice is not "wild guess" because simply you solved my problem.

    thank you very much, as i tried to call this slot the compiler showed "unresolved external"
    though i was writing its implementation, then i discovered that there is an old version
    of dll that visual studio is still binding to it, i simply deleted it and re-bind with the
    new dll and everything is ok.

    Thank You Very Much.

  11. #11
    Join Date
    Jun 2009
    Posts
    11
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: no such slot

    for sure and also i found the home() slot found in qt_metacall(...) method inside
    moc_QuarterWidget.cpp.


    but as i make the connection it returns false, i don't know why.

Similar Threads

  1. How to declare SLOT as a parameter to member function?
    By QPlace in forum Qt Programming
    Replies: 2
    Last Post: 17th July 2018, 00:41
  2. Differences in calling a Slot
    By Denarius in forum Qt Programming
    Replies: 7
    Last Post: 28th April 2009, 15:32
  3. Replies: 12
    Last Post: 18th September 2008, 15:04
  4. Problem When Creating my own Slot
    By Fatla in forum Qt Programming
    Replies: 12
    Last Post: 6th June 2008, 14:44

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.