connect() new style syntax return result
-
And IIRC, the "old" system is also what allows for things like QML to work its magic.
The porting of the example is a good idea. The documentation team would be happy to get some help with that so you are more than welcome to submit patches. I think there are tasks related to that on the bug tracker to help organise.
-
@J-Hilk
I asked an intentional question: I know you to be a good citizen, so do you check all your new-styleconnect()
s at runtime? I should like to know....@JonB said in connect() new style syntax return result:
so do you check all your new-style connect()s at runtime?
I have never written any checks and never seen any checks in any source code. In normal circumstances connects should be well structured and not occur everywhere in your source code. Connects for general QActions (menus, toolbars, etc.) we connect once at startup. When dialogs are constructed, we connect in the constructor (or the functions that creates a small dialog on demand). Rarely don't we have the object we'd like to connect. Then, there would not be any failures in connects when they succeded compiling in the new syntax. We still have a lot of old connects where it compiles even if the signal or slot name is wrong. However, Qt writes it out to the command line and this is where we catch these errors. So, in all our scenarios either the connect always succeeds or always fails. It does not depend on any runtime behaviour. This means, once a connect is known to work, we can forget about it.
-
And IIRC, the "old" system is also what allows for things like QML to work its magic.
The porting of the example is a good idea. The documentation team would be happy to get some help with that so you are more than welcome to submit patches. I think there are tasks related to that on the bug tracker to help organise.
@SGaist said in connect() new style syntax return result:
And IIRC, the "old" system is also what allows for things like QML to work its magic.
Correct. The old syntax lets us make connections between C++ code and QML code.
It also supports dynamic meta objects which the new syntax can't support: https://www.qtdeveloperdays.com/sites/default/files/QtDevDays2014US-DIY-moc.pdf (useful for language bindings)