Results 1 to 5 of 5

Thread: no such slot

  1. #1
    Join Date
    Dec 2007
    Location
    Groningen Netherlands
    Posts
    182
    Thanks
    16
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default no such slot

    I have a tableview and I'm trying to get onactivated to work but it does not fire and I get:
    Object::connect: No such slot MainWindowImpl::rowActived(QModelIndex)

    This is my code:
    mainwindowimpl.h :
    Qt Code:
    1. class MainWindowImpl : public QMainWindow, public Ui::MainWindow
    2. {
    3. Q_OBJECT
    4. .private slots:
    5. void rowActivated(const QModelIndex &);
    To copy to clipboard, switch view to plain text mode 
    mainwindowimpl.cpp in constructor:
    Qt Code:
    1. connect(table, SIGNAL(activated(QModelIndex)), this, SLOT(rowActived(QModelIndex)));
    To copy to clipboard, switch view to plain text mode 
    The event
    Qt Code:
    1. void MainWindowImpl::rowActivated(const QModelIndex &index)
    2. {
    3. qDebug() << "activate" << index.row();
    4. }
    To copy to clipboard, switch view to plain text mode 

    Putting the const and & into the connect() call makes no difference, besides, all other events fire without the const and & in their connects.
    No idea what this is. Help appreciated.

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: no such slot

    You must pass the slot & signal according to their signatures, that is with "const QModelIndex&".

    I am surprised that it works in other cases, as you mentioned it.

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: no such slot

    You have a spelling error - "actived" vs "activated".

  4. #4
    Join Date
    Dec 2007
    Location
    Groningen Netherlands
    Posts
    182
    Thanks
    16
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: no such slot

    Yes correct.
    Been staring at it for hours, even copied the same typo over to a little test project.
    I am very ashamed.

    Thanks folks.

    Quote Originally Posted by wysota View Post
    You have a spelling error - "actived" vs "activated".

  5. #5
    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

    Quote Originally Posted by marcel View Post
    You must pass the slot & signal according to their signatures, that is with "const QModelIndex&".

    I am surprised that it works in other cases, as you mentioned it.
    Actually, you can fairly well use "QModelIndex" in place of "const QModelIndex&". See QMetaObject::normalizedSignature() for more details.
    J-P Nurmi

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

    marcel (26th January 2008)

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. Replies: 2
    Last Post: 8th October 2007, 15:02
  3. Slot to color background of line edit on textedited
    By tpf80 in forum Qt Programming
    Replies: 5
    Last Post: 21st June 2007, 09:02
  4. Problem with slot
    By beerkg in forum Qt Programming
    Replies: 29
    Last Post: 3rd April 2007, 19:54
  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.