funchelpers: Add a way to invoke a callable with a list of arguments
In various places, we serialize function arguments as a QVariantList,
and later use QMetaMethod and friends to call a slot with that list.
In order to avoid this kind of runtime method lookup, we need a way
to directly invoke a given callable (e.g. a function pointer) with
a list of serialized arguments. We'll also want to use the type-based
conversion functionality of QVariant instead of using undocumented
methods and reinterpret_cast'ing raw memory, as is currently the case.
Provide a method invokeWithArgsList() that takes any callable and
a list of arguments serialized in a QVariantList, performs some
runtime sanity checks (argument count and types), and invokes the
callable with the arguments converted to the correct type, if
possible.
Also add a test case for this function.