Results 1 to 3 of 3

Thread: No such slot in subclass?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2009
    Posts
    18
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default No such slot in subclass?

    This is a cry for general help in finding what I've done wrong.

    I have a

    Qt Code:
    1. class A:public QSomeClass
    2. {
    3. public:
    4. dostuff();
    5. public slots:
    6. void foo();
    7. }
    To copy to clipboard, switch view to plain text mode 
    and in dostuff() I have the line:
    Qt Code:
    1. connect(this,SIGNAL(some_signal_from_base_class),this,SLOT(foo()));
    To copy to clipboard, switch view to plain text mode 
    but it reports:

    Qt Code:
    1. Object::connect: No such slot QSomeClass::foo()
    To copy to clipboard, switch view to plain text mode 

    Why does it not detect the slot in my class?

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: No such slot in subclass?

    You forgot the required Q_OBJECT macro.
    J-P Nurmi

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

    codemonkey (14th January 2010)

  4. #3
    Join Date
    Oct 2009
    Posts
    18
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: No such slot in subclass?

    Yes, that was it. Thank you.

Similar Threads

  1. Subclass QStatusBar
    By 1111 in forum Qt Programming
    Replies: 2
    Last Post: 20th February 2009, 10:14
  2. Signal in base class Slot in Subclass
    By csvivek in forum Newbie
    Replies: 7
    Last Post: 30th March 2008, 16:59
  3. Subclass and Connections
    By merry in forum Newbie
    Replies: 10
    Last Post: 6th March 2007, 13:19
  4. Subclass
    By merry in forum General Programming
    Replies: 2
    Last Post: 1st March 2007, 10:34
  5. signal slot conection using a string, not a SLOT
    By rianquinn in forum Qt Programming
    Replies: 6
    Last Post: 5th February 2006, 18:52

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.