[Development] Contribution proposal: Dispatcher class
Yam Marcovic
ymarcov at gmail.com
Thu Sep 25 15:55:24 CEST 2014
Technically it sounds good to me. But would it be consistent with the
responsibility of QMetaObject? It doesn't use any metadata from the object
passed, unlike the other overloads.
On Sep 25, 2014 3:14 PM, "Olivier Goffart" <olivier at woboq.com> wrote:
> On Saturday 20 September 2014 12:41:07 Yam Marcovic wrote:
> > 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
>
> Hi,
>
> I think if this feature would be added to QtCore, it should be by extending
> QMetaObject::invoke to work with functors.
> By using Qt::BlockingQueuedConnection that would be very similar to what
> you
> have done.
>
> Regards,
> --
> Olivier
>
> Woboq - Qt services and support - http://woboq.com - http://code.woboq.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20140925/000e6357/attachment.html>
More information about the Development
mailing list