Reject arguments that cannot be converted to the declared type
When neither conversion attempt succeeded, toVariant() warned and
returned the unconverted value anyway. invokeMethod_helper() then passed
its address to QMetaMethodInvoker under the declared metatype, which
performs no conversion of its own, so the callee read a value of one
type as another.
Return std::nullopt instead, so the invocation is abandoned at the first
argument that fails and the method is never called.
Pick-to: 6.8 6.12
Task-number: QTBUG-151083
Change-Id: If1baae35a91d06b1d01a3356f385f32cc4e65b6d
Reviewed-by: Arno Rehn <a.rehn@menlosystems.com>