You are not logged in.

Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Thursday, May 17th 2007, 10:23pm

ConnectSlotsByName???

In our startup process, we are seeing a long stream (100's) of messages like:

Source code

1
2
3
13:27:08:281  QtWarning	QMetaObject::connectSlotsByName: No matching signal for on_buttonRenameFile_clicked()
13:27:08:296  QtWarning	QMetaObject::connectSlotsByName: No matching signal for on_buttonEmailImage_clicked()
13:27:08:328  QtWarning	QMetaObject::connectSlotsByName: No matching signal for on_buttonEmailText_clicked()


We do have a series of connect calls like:

Source code

1
connect(ui.FwBitmapButtonRenameFile, SIGNAL(clicked(bool)), this, SLOT(on_buttonRenameFile_clicked()));


but they don't appear to be triggering these warnings. First, our connect( ) calls are not in the order the warnings are appearing, and second, our buttons do work, so we assume our connect( ) calls are correct.

It appears that these connectSlotsByName are coming from the MOC file, but we can find nothing in the ui file that we would expect to trigger them.

Where do these connectSlotsByName calls come from, and how can we eliminate them?

2

Friday, May 18th 2007, 12:09am

RE: ConnectSlotsByName??? - SOLVED

We have solved our problem. For the benefit of others, here is the email sent to our group once we figured it out:

--------------
After a bit of sleuthing to find the source of all the Qt warnings, “QMetaObject::connectSlotsByName: No matching signal for…”, in our log window/file, here’s what I’ve found.

setupUi calls connectSlotsByName. connectSlotsByName parses the moc_ file in order to connect slots and signals. The moc_ file contains a list of all the slots for the class. The parser iterates over the list of slot names looking for the following pattern: on_objectName_signal, where on_objectName_signal is the name of the slot, objectName is the object name and signal is the signal. For example, if you have a slot named, on_doneButton_clicked(), the parser looks for an object named doneButton, a signal named clicked and then connects the on_doneButton_clicked() slot to QButton’s signal clicked().

If you follow this naming convention, you do not need to call the connect() method, nor do you need to connect the signal via the Qt UI editor in VisualStudio. connectSlotsByName will automatically make the connection for you.

So, in order to get rid of the “No matching signal for…” warnings, we need to either follow this naming convention, or make sure none of our slot names begin with “on_”. If you have a slot, onDoneButton_clicked, for example, connectSlotsByName will no try to connect it with a signal, nor will emit an warning.

3

Thursday, August 16th 2007, 8:00pm

Just wondering-- is there a way to suppress these warnings? I haven't seen anything so far in the documentation to suggest that there's control over this.

We're migrating from QT3 to QT4, and so have a LOT of functions that are named using the "on_XXX" convention, but that aren't named quite right for the corresponding objects and signals. So, it's a fair bit of work to change this, but I find the warning messages irritating...

4

Thursday, August 16th 2007, 8:07pm

We did not find any way to hide the warnings, but we really didn't want to anyway. In tracking the code, it was clear that a LOT of code was being run before it decided it couldn't succeed -- which resulted in the warning.

We were getting a couple hundred of these warnings when we first started tracking it down. Took about a day or so to remove them all by renaming the appropriate fields. The result was a significant improvement in launch time.

I would just consider this one of the costs of upgrading. Bite the bullet and fix the code so that warnings don't show. They are there for a reason -- they are telling you that it will work, but it won't be pretty... :)

5

Thursday, April 30th 2009, 12:49am

I had a similar issue, thanks for posting the solution.

My problem was that I had something like on_button_Clicked() so I changed to on_doneButton_clicked() and got rid of the warning.