[Development] invokeMethod() with function pointers
b.terrier at gmail.com
Tue Jan 24 12:34:01 CET 2017
I'd like to get this in before 5.9 FF.
The current state is:
- It works for member functions, function pointers and functors
- It soft breaks existing code that were passing null literals.
- The new functions do not accepts any arguments, users have to use lambda
- The new functions do accept an optional return argument in the form
"ReturnType *" (without using Q_ARG),
the type is checked during compilation for function pointers (member or
not) using QtPrivate::FunctionPointer.
I am not sure for functors though as QtPrivate::FunctionPointer does not
work in this case, but QFunctorSlotObject
ensure that the actual return type of the functor can be assigned to a
What must be done:
- Add documentation
- Complete auto tests
- Optionally, remove the "ReturnType *" argument and for users to use
lambda with capture.
This remove the need to check for return in case of queued connection, but
add the responsibility for the user to ensure the lifespace
of variable captured by reference to sill be valid when the lambda is
- Optionally, move the function pointer/lambda to the last argument
position. This can make nicer code when using lambda,
at the cost of having to provide more overloads instead of using optional
I would appreciate if any of you could check the gerrit change (
https://codereview.qt-project.org/#/c/182339/) and provide feedbacks,
especially if there is anything that would require a major change of the
Also, I'd like to get more opinions about the 2 optional changes.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Development