[Development] Proposal to change connectSlotsByName behavior

Rutledge Shawn Shawn.Rutledge at theqtcompany.com
Mon Dec 7 07:53:12 CET 2015


> On 4 Dec 2015, at 09:01, André Somers <andre at familiesomers.nl> wrote:
> I'd like to add a new alternative (though it does not exclude a change now either):
> 
> - Deprecate the behaviour and remove in Qt 6.
> 
> I have never thought this feature to lead to good design. It makes for "magic" in the sense that it is tricky to trace what happened. It leads to un-Qt-ish naming of methods, and it leads to naming methods based on when they are triggered instead of what they do. I find the latter usually leads to more readable code, more so if there is more than one way to trigger the behaviour encoded in the method. Last, I think private slots (for which this would be most used) are largely on the way out anyway. Trivial slots can be replaced by lambda's and non-trivial ones need a good function name anyway.

The main reason I (and probably many others) end up using this feature is because Creator will automatically write the handler for any signal if you right-click on a widget in the designer view and select Go to Slot…  So after we’ve decided what the pattern should really be, somebody needs to make Creator do it in the optimal way.  Otherwise we are effectively promoting use of this feature.  I’ve never used it when writing handlers by hand.



More information about the Development mailing list