"go to slot" vs coded signal/slot connection
-
@MortyMars
Well it seems to me that's just because now you are not telling it that it's a slot at all it doesn't warn you about the way it's namedon_....
being "error prone". It's not an error, it's a diagnostic warning from clazy. If you don't have theconnectSlotsByName()
call (insetupUi()
, I think, and I believe it can be turned off, which most of us do, or even if that's not possible we just don't name slots thaton_...
way, which Designer does, so it doesn't arise). I would rather have them marked asslots
if they are slots, but not use the auto-connect-by-name. But it's up to you.What you should not do is on the one hand have the slots created/named and use the auto-connection and then also put in your own explicit
connect()
statements. That will lead to duplicate connections. Most of us long-termers use *jusT8 explicitconnect()
s, like the one you show.BTW, have a look at the thread from one of our experts going on in https://forum.qt.io/topic/156017/slot-naming-convention. Note that whichever naming convention people are picking there it is not the special
on_....
for the automatic connect slots. -
@MortyMars simple: don't use underscore in your function name, and you're 100% fine
-
@MortyMars
That's why I tried to explain earlier:we just don't name slots that
on_...
way, which Designer does, so it doesn't arisewhichever naming convention people are picking there it is not the special
on_....
for the automatic connect slots:)
-
It is not my habit to participate in opinions discussion,
maily because it gets (often) sidetracked into criticism of expressions instead of staying on the subject.With that - Qt Inc. published numerous examples.
One of the "features of C++ , when originally introduced was " code reuse ...".
So - why reinvent the wheel when there is a suitable Qt example to "cut and paste" ?Doing that - one gets "stuck "
with using "go to slot" or "old way " to "connect" ...The bottom line - it is (personal) choice what to use,
BUT,
I just do not get the opinions that "it is unreliable , hence it should not be used "
END OF RANT -
@AnneRanch said in "go to slot" vs coded signal/slot connection:
One of the "features of C++, when originally introduced was " reuse ...".
So - why reinvent thre wheel when there is a sitablke Qt example?
The one gets "stuck "
with usign "go to slot" or "old way " to "connect" ...You got yourself into this situation. Nobody forced you to use this whole "QtDesigner"-"GoToSlot"-thing. Because I doubt that anybody uses all these QtDesigner functions and utilities in a serious matter.
These are "difficulties" you wouldn't have, when having proper C++ knowledge.It may seem easy and tempting to put together a GUI in QtDesigner "quick and dirty"... but especially if you want to be able to scrutinize everything and dig down to the roots, as you do (valid, not blaming you on that)... just knowing (or forcing to use) the "GoToSlot" function is.... surprise... not enough.
Qt is a C++ framework after all. And that's not something you can use and control by clicking with your mouse on pretty, shiny WYSIWYG editor windows.
(QtDesigner is actually more WYSIWYG-"lite") -
@Pl45m4 I am tempted to report your post to somebody who cares.
THIS CONSTANT BASHING GOT TO STOP.It is against my nature to discuss such behaviour,
however, I am going to reply in same style.( I do not care TO GET BANNED FROM ThIS CESS POOl
I haVE HAD IT )Would you PLEASE go back to kindergarten school and learn how NOT TO PUT PEOPLE DOWN ?