[Development] Changes to QObject::connect and other functor-taking API implementations

Uwe Rathmann Uwe.Rathmann at tigertal.de
Wed May 3 10:51:17 CEST 2023


Hi all,

 > What started as an attempt to provide a few building blocks for 
making > it easier to build asynchronous APIs taking any kind of 
callable (like > QTimer::singleShot ...

Sorry for posting without checking your implemented solution:

one of the goals of my QSkinny ( https://github.com/uwerat/qskinny ) 
project is to allow more lightweight Qt/Quick applications. And one 
detail is about not having to create QObjects for simple callback 
situations.

It is quite some time ago ( ~2017 ), that I made that implementation but 
IIRC the main challenge was about identifying the callback parameters 
using meta template programming instead of having them from the signal 
signature. The rest is more or less given by the design of 
QtPrivate::QSlotObjectBase

It does not make the definition of functor callback APIs a no-brainer - 
but IMHO it is much better than what you would have to do without.

See: 
https://github.com/uwerat/qskinny/blob/master/src/common/QskMetaFunction.h

The implementation is heavily used for processing machine data in a 
commercial project ( avoiding >1K of QObjects ). Unfortunately I can't 
show it here - but there is at least one example how to build an API 
with it in QSkinny itself:

https://github.com/uwerat/qskinny/blob/master/src/controls/QskShortcutMap.h
https://github.com/uwerat/qskinny/blob/master/support/SkinnyShortcut.cpp

There is a small demo/test program available that does a bit more with 
this all: https://github.com/uwerat/qskinny/tree/master/playground/invoker

In case you find something of interest in my implementation: QSkinny 
code is BSD-3-Clause.

ciao,
Uwe


More information about the Development mailing list