I am quite new to Qt and I have worked away with their slots & signals without too many problems until in one occasion on a new project, I was not able to get my signal connected to my slot… that kept me stuck for a good while, double checking that I had done all I thought was necessary for it to work correctly (QObject inheritance, proper spelling (!), etc.) but to no avail.
Out of desperation, I “googled” the error message and a bit by chance, I found this post. This solved my problem, my slot name started with on_ . Once changed, the signal connected correctly to my slot ! 😀
Now, I don’t mind that Qt integrates some “shortcuts” to do some quick and dirty job, but there I cannot find any reference to it in the documentation on signals and slot and the error message does not even mention this possibility… Given that the naming convention is quite common, this is probably a problem that many people experience first time, so I thought that may be useful to someone else. The official explanation can be found on Qt’s documentation: the whole rationale for this seems to be in the last sentence:
By providing source code that implements a given interface, user interface designers can check that their designs actually work without having to write code themselves.
That sounds like a nice feature for UI designers, but then let it as an option that can be enabled when required but disabled by default (letting people choose the format of the implicit name as a regular expression would also be nice not to impose this particular naming convention on everyone), this would not trip people up for nothing.
Still, I favor the explicit connect as you can clearly see what gets connected to what and do not rely on some convention being respected for it to automagically generate the correct code. The day it breaks, it is hard to find out why.