[Development] invokeMethod() with function pointers

Grégoire Barbier devel at g76r.eu
Thu Jan 19 16:18:30 CET 2017


Le 17/01/2017 à 18:11, Thiago Macieira a écrit :
> Em terça-feira, 17 de janeiro de 2017, às 11:21:56 PST, Grégoire Barbier
> escreveu:
>> And maybe lambdas too, if there was a way to choose the thread/eventloop
>> in which we want the lambda to be executed (but christmas was a few
>> weeks ago, I should not dream ;-)).
>
> If we do this, it should be possible to write:
>
> 	QMetaObject::invokeMethod(object, [=]() {
> 		doSomething(); return something; },
> 		Qt::BlockingQueuedConnection,
> 		Q_RETURN_ARG(foo));

It would be great. :-)

> Since we have lambdas and std::bind, I don't see the point of supporting
> passing arguments.

Agree.

> The return value is interesting still.

With lambdas the return value itself can be replaced with a captured 
reference, isn't it ?
Anyway it's still convenient to have it when calling plain old methods 
rather than lambdas.


-- 
Grégoire Barbier :: g à g76r.eu :: +33 6 21 35 73 49



More information about the Development mailing list