[Development] Proposal: adding overloads to pre-existing member functions is ok as long as not a slot

Volker Hilsheimer volker.hilsheimer at qt.io
Mon Jul 27 10:54:51 CEST 2026



> On 24 Jul 2026, at 20:03, Edward Welbourne <edward.welbourne at qt.io> wrote:
> 
> Volker Hilsheimer (24 July 2026 17:25) wrote, inter alia:
>> - functions marked as slots (or signals) must not be overloaded
> 
> ... unless they already are ?
> Presumably if they're already overloaded, adding new overloads isn't a
> problem, because anyone taking their addresses already needed to use
> QOverload<>.
> 
> 	Eddy.



While technically true, I’d rather not make things worse for our future selves.

API design for signals and slots is ideally symmetrical: having functions designed as slots, but no corresponding signal to connect to is not helpful; and Qt objects will typically have only one signal overload (if you have an overloaded signal, then all overloads need to be emitted, which is both weird and inefficient).

Volker



More information about the Development mailing list