I set a QT menu, which is automatically connected with action function on_actionOpen_triggered()
. Later I want to pass a filename string to this function in order to call this function manually in a special condition. So I changed the function signature to on_actionOpen_triggered( const char *filename_in )
. After this change the program is running well, but there is a complain in terminal,
QMetaObject::connectSlotsByName: No matching signal for on_actionOpen_triggered(const char*)
I am wondering what happened, and how I can add arguments for this menu action functions.
Thank you.
I was facing same Warning/Error
QMetaObject::connectSlotsByName: No matching signal for
And got simple solution. For Example:
Problem :QMetaObject::connectSlotsByName: No matching signal for on_actionOpen_triggered(const char*)
Warning
You just need to change the name of the Slot
Solution
Change Slot name like on_actionOpenTriggered
and this warning disappear.
Hint
Qt try to understand its default slot like on_<name_of_object>_<action>
, So if you specify any slot with above signature, Qt will throw warning.
Hope it will help to someone.
Qt autoconnection mechanism can't find suitable signal to your slot. For menu item there's no signal that would match your slot with one argument, and signal must not have fewer arguments than slot.
You can change slot's name so that it won't try to find a matching signal, and use QObject::connect
directly instead of QMetaObject::connectSlotsByName
. Moreover you'll have to assign default value to your argument filename_in
if you want connect
to work with triggered
signal.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With