[Development] Contribution proposal: Dispatcher class

Yam Marcovic ymarcov at gmail.com
Sat Sep 20 11:41:07 CEST 2014


Hello,

In my company, we started getting all tangled up with loads of signals and
slots for many components. We also have a habit of renaming things as time
goes by, and that can also pose a bit of a problem when dealing with
signals & slots, meta object based invocations, etc.

So, since our compiler supports the relevant features of C++11, I've made
this class, called Dispatcher, which allowed us to develop multi-threaded
apps much more easily. Instead of defining many signals and slots, you
simply make your component extend QObject, and then, since you can use it
with Qt's multi-threading framework, you can use it with the dispatcher.

Here's the link to my repository on GitHub. It also gives a small usage
example.

https://github.com/ymarcov/qtdispatcher

Note that I've striven to make it as correct as possible. E.g. if the
return value is a reference, then you really get that reference, not a copy
of it, and same with pointers. Or if it's by value, and the returned object
has a move constructor, then it will be used. Stuff like that. It's been
working very well for quite some time now in my workplace, and used in
quite critical areas of the code with much success.

Please let me know if you think this could help the Qt project as a
built-in class.

With best wishes,
Yam Marcovic
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20140920/7343eada/attachment.html>


More information about the Development mailing list