QMetaObject::connectSlotsByName: No matching signal for - Intentional, so how do I suppress the message?
-
An application that I am converting from MFC to QT has a password feature where one class is used for two different dialogs. One is for password entry and verification, and the other is for changing your password.
The password entry dialog just has the text input field with two pushbuttons: OK and Cancel. The password change dialog has three text input fields (enter current, enter new, re-enter new) but has three pushbuttons: OK, Cancel, and Help. Dialog selection is made by what constructor is used for the class (PW change has additional parameters).
This all works exactly as it should, but when the password entry dialog opens up, this debug message is sent:
QMetaObject::connectSlotsByName: No matching signal for on_Help_clicked()
Of course it does! Since there is no Help button in this dialog, there is no signal.
My question: Is there a way in code that can suppress this message?
I'm figuring the easiest way would be to add a Help button in the dialog and make it not visible, but I'm wondering if there is a simple way in code to do this.
-
@Calvin-H-C said in QMetaObject::connectSlotsByName: No matching signal for - Intentional, so how do I suppress the message?:
s there a way in code that can suppress this message?
Rename your slot and/or disable this feature.
-
@Christian-Ehrlicher The Password Change dialog uses this slot, so I cannot rename it, it must stay there.
If I change its name, would I have to manually connect it for the Password Change dialog? If so, what parameters are used for the signal side of connect()?
-
@Calvin-H-C said in QMetaObject::connectSlotsByName: No matching signal for - Intentional, so how do I suppress the message?:
what parameters are used for the signal side of connect()?
You should really read https://doc.qt.io/qt-6/signalsandslots.html
It is anyway better to do the connections manually, because the autoconnect feature is unreliable. -
@Calvin-H-C I assume you are using Designer to generate the UI code. The default
uic
generated code behaviour is to auto-connect by name. This can be suppressed by passing the-a
or--no-autoconnection
option touic
. In a qmake project file this could be achieved using the QMAKE_UIC_FLAGS. Your code must then connect everything manually.