PDA

View Full Version : no such slot



JeanC
26th January 2008, 08:57
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 :


class MainWindowImpl : public QMainWindow, public Ui::MainWindow
{
Q_OBJECT
.private slots:
void rowActivated(const QModelIndex &);

mainwindowimpl.cpp in constructor:


connect(table, SIGNAL(activated(QModelIndex)), this, SLOT(rowActived(QModelIndex)));

The event


void MainWindowImpl::rowActivated(const QModelIndex &index)
{
qDebug() << "activate" << index.row();
}


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.

marcel
26th January 2008, 09:33
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.

wysota
26th January 2008, 10:23
You have a spelling error - "actived" vs "activated".

JeanC
26th January 2008, 10:33
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.


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

jpn
26th January 2008, 11:39
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.