[Development] RFC: banning _q_slot() in favour of new-style connect()?

Olivier Goffart olivier at woboq.com
Fri Oct 12 10:26:04 CEST 2012


On Thursday 11 October 2012 23:06:18 Thiago Macieira wrote:
> On sexta-feira, 12 de outubro de 2012 07.27.51, Marc Mutz wrote:
> > Hi,
> > 
> > I was wondering whether we should stop using the pattern of declaring
> > _q_privateSlots() in favour of connecting to functors or functions
> > directly.
> Makes sense, except that it's of inconvenient use:
>  - lambdas: can't use in Qt code
>  - functors: inconvenient (need to be out of the class)
>  - static member or free functions: will not have access to the target
> object - private member functions: disallowed by Qt coding guidelines


That is indeed a problem: it is not possible to connect to member function of 
a QObjectPrivate, only QObject.

One could add an overload  (or even a QObjectPrivate::connect) that connect to 
a QObjectPrivate function.
>From the implementation point of view  it is just a matter of adding a 
QPrivateSlotObject inhartiting from QSlotBase.

-- 
Olivier

Woboq - Qt services and support - http://woboq.com





More information about the Development mailing list