Qt connect "no such slot" when slot definitely does exist

Check whether whether that moc_mainwindow.cpp is in your Build Path. Or you are using some other moc_window.cpp file. Because, for ex: In QtCreator, it build the source to a new build directory. And also it uses old moc_cpp file(s) if you try to open the source in a different location.

What I am trying to say is the moc file which you checked may contain those slot definition, but compiler might be using some other moc file which was created earlier.


I solved the problem like this

private slots:
    void on_comp_connected(const QUuid &qcid);

then in constructor

connect(tabWidget, SIGNAL(currentChanged(int)), this, SLOT(on_comp_connected(QUuid)));

I solved problem by adding Q_OBJECT macro in mainwindow class. In addition to this, also check the sequence in which classes are inherited.