user3443063
user3443063

Reputation: 1623

No slots but QMetaObject::connectSlotsByName error using Qt and C++

I'm programming in C++ and Qt Creator and my code works perfectly. Nevertheless I've got the problem that I get a warning when I compile my code.

QMetaObject::connectSlotsByName: No matching signal for on_but_PrintTab_clicked()

There used to be a slot named on_but_PrintTab_clicked(), but it no longer exists. How can I get rid of this warning?

Upvotes: 2

Views: 1142

Answers (3)

Hemapriya
Hemapriya

Reputation: 19

Either Change the name of the function or instead of declaring the function in public/private slots declare it in public or private.

Upvotes: 0

Nejat
Nejat

Reputation: 32675

The Qt autoconnect mechanism tries to connect signals to slots of objects with the form of:

void on_<object name>_<signal name>(<signal parameters>);

So here it tries to find an object with the name but_PrintTab which has a clicked signal to connect it to your slot. But there is not such a thing and it outputs that warning.

In case you have such a slot, you should change it's name to something else to avoid this warning.

If the button and slot no longer exist, try to run qmake again on your project and it would be solved.

Upvotes: 1

laurent
laurent

Reputation: 90853

There is a connect() call somewhere in your call that is trying to connect to on_but_PrintTab_clicked. Just search for "on_but_PrintTab_clicked" and remove this connect() call.

Upvotes: 1

Related Questions