Details
-
Task
-
Resolution: Out of scope
-
Not Evaluated
-
None
-
None
-
None
Description
Hi,
QMetaObject::invokeMethod currently depends on Q_INVOKABLE to be present to allow a function to be called. That doesn't have to be the case anymore in terms of it's functionality and C++17.
The method already gets the object where it has to invoke a function. Next it only needs a function pointer address to work where that now is a method name as string. Basically the same like the modern connect syntax but only of the slot part.
std::invoke can (should?) be used internally, that function is available since C+17: https://en.cppreference.com/w/cpp/utility/functional/invoke but it looks like a library side implementation detail only so i wouldn't be surprised if you could make it work with C14 or even C+11.
This will make QMetaObject::invokeMethod more broadly usable as it would (probably?) have the same rules as the new signal/slot connection syntax making it possible to call any public function that way as opposed to only those specified by Q_INVOKABLE.
Cheers,
Mark