[Development] A modest proposal: disable lower-case keywords (emit, foreach, forever, signals, slots) by default

Shawn Rutledge Shawn.Rutledge at qt.io
Fri Feb 21 15:12:16 CET 2020


> On 21 Feb 2020, at 14:26, Giuseppe D'Angelo via Development <development at qt-project.org> wrote:
> 
> Il 21/02/20 13:59, Shawn Rutledge ha scritto:
>> (Some people name every slot function starting with the word “slot” to make clear what it is.)
> 
> So, literally any function they write, since _anything_ can be a slot? Or any function in a QObject subclass? (Not to mention that functions are supposed to describe what they do, not what they react to...)
> 
> Sigh..

Anything that is declared in the slots section of a QObject.  Yeah it’s an obsolete convention nowadays, but the company where I worked around 2007-2009 liked doing it that way.  But while any function can be connected to a signal now, not any function can be used as a signal emitter (at least not yet ;-) so maybe it makes more sense to have a naming convention for signals rather than slots: e.g. signalXChanged.  “Signal” is both a verb and a noun, so in the context of calling signalXChanged(), you can read it as “signal that X changed.”



More information about the Development mailing list