Solved Safe to ignore "No matching signal for ..."?
-
@legitnameyo please try to comment your connect statement - I'm sure the error persists.
"Connectslots by name" is exactly the auto-connect you mentioned, without a connect from your side.
PS: you should use the Qt5 functor style connect, which gives compile errors on signal-slot mismatch.
Regards
-
@aha_1980 said in Safe to ignore "No matching signal for ..."?:
@legitnameyo please try to comment your connect statement - I'm sure the error persists.
What do you mean by "I'm sure the error persists"? I am also sure the error persists if I comment the connect, since comments does not affect the actual code after being compiled.
"Connectslots by name" is exactly the auto-connect you mentioned, without a connect from your side.
From my side? What is the other side? and I know there is an auto-connect thingy or whatever within QT but what I am asking is: is it safe to ignore? Not if it gives me compiler error, I know it does. Not if I should follow Qt5 function style connect or Qt 4 or whatever, only: is it safe to ignore?
-
What do you mean by "I'm sure the error persists"?
He means: comment out your own
connect()
statement and verify that you still get thatconnectSlotsByName()
error message, i.e. it's nothing to do with yourconnect()
. -
@legitnameyo said in Safe to ignore "No matching signal for ..."?:
only: is it safe to ignore?
It is never safe to ignore warnings.
What do you mean by "I'm sure the error persists"? I am also sure the error persists if I comment the connect, since comments does not affect the actual code after being compiled.
Please remove your connect statement by either deleting it or commenting it out.
For 99% the warning is not from this connect, but from somewhere else.
-
@legitnameyo said in Safe to ignore "No matching signal for ..."?:
since comments does not affect the actual code after being compiled
They do if you comment out a line of code, since this line will not be compiled.
"is it safe to ignore?" - safe in the way that your app will not crash. But it is always better to resolve all warnings. Try to rename the slot to see whether the auto-connect feature is not triggered then.
-
The error is still there after commenting out the connect();
-
@legitnameyo Then try to rename your slot and check again.
-
The error disappears when I comment out connect() and move the definition of the function that I got in my SLOT, inside connect, to the top in my .h file. When I re-add the connect() inside my .cpp the error is still there HOWEVER the program, just as before, runs smoothly. So again: is it safe to ignore? Is the error just a guideline or is it possible that it will break on another OS? On another OS version? Is it SAFE to ignore? Does anybody know what the error implies?
-
@legitnameyo Did you try to rename the slot?
Because QMetaObject::connectSlotsByName tells that auto-connect is trying to connect the slot... -
@others
The point is that OP knows he is not following the slot naming convention, he does not wish to, and is asking whether he "can get away with" ignoring the warning.@legitnameyo
Chances are it is just a warning that it cannot find the slot name it expects but you are choosing not to supply, and will work OK, it's your decision. However, I too would not wish to leave a warning in for this. So if I were you I'd have Googled forconnectslotsbyname no matching signal
and read through the hits to see if there is a way to suppress this if you don't want to follow the naming the convention (most seem to just say "rename your slot", I don't know if any offer how to suppress it). -
you
create_new_button
is suspiciously close to what theconnectSlotsByName
is looking forvoid on_<object name>_<signal name>(<signal parameters>);
it shouldn't trigger as the first part is wrong. But maybe ?What version of Qt are you using?
also try a complete rebuild. If you added slot from the designer and manually removed the generated code. the moc file will be wrong and will cause all kinds of warning/issues
-
Qt Creator 4.8.1
Based on Qt 5.12.0 (Clang 10.0 (Apple), 64 bit)
on a MacBook Air (13-inch, Early 2014) running macOS Mojave 10.14.I've added everything in the code, nothing in the actual UI designer of Qt Creator.
@JonB gets the point! From what I've googled it seems as if there should be no performance issues from not following the conventional signal slot style. Some people say it COULD break and/or give performance issues but nobody seems to have actually tried it out or experienced any issues that are noticeable. I'll set the thread as solved since nobody experiences issues and I'll just make the assumption that it's up to me to follow conventional styling or not. Thanks!
-
@legitnameyo said in Safe to ignore "No matching signal for ..."?:
Qt Creator 4.8.1
Based on Qt 5.12.0 (Clang 10.0 (Apple), 64 bit)A common enough mistake, that is the version of QtCreator not necessarily the same as the one you're using for your project
-
True. I gleaned in the build settings and it looks as if I'm using
Desktop Qt 5.12.1 clang 64bit
-
@legitnameyo alright, wouldn't surprise me if there's a bug in 5.12.0 or 5.12.1 .
The 5.12 release was way too bumpy in my opinion.Maybe worth a try to update to 5.12.3, if you want to invest the time downloading the precompiled libs.
-
In my experience, on macOS Mojave 10.14, there are some clashes and bugs between newer versions of Qt and the OS so I won't try to update. I don't want to run the risk of spending a few hours upgrading and then possibly downgrading as well as reinstalling stuff.
I don't experience and I don't see other people experiencing performance issues with this error, so I won't try anything unless somebody comes out and explicitly says there are performance issues or possible breaks on other OS's.
-
@legitnameyo you can have multiple versions of Qt on your system in parallel and you can easily switch between them via the "kit selection" inside QtCreator
-
That's a really neat feature! I'll try it out some time in the future but for now I think the thread is done. The explicit and concrete answer to my question won't come from a new version but rather from an analysis of the source code of Qt (or possibly tests on different computers and OS's). Thanks anyways!