Reject object references that cannot be resolved


When an object id did not match registered or wrapped object,
toVariant() warned and then returned a variant holding a null QObject*
anyway. The caller had no way to tell that apart from a legitimate JSON
null, so a method was invoked with a null argument and a property was
silently cleared.

Return std::nullopt instead and let callers abandon the call.
An explicit JSON null is still accepted as the intended way to pass a
null pointer.

Pick-to: 6.8 6.12
Task-number: QTBUG-151083
Change-Id: Icd7e88bc2866417e3fb8502a1e30d05aa722e7c4
Reviewed-by: Arno Rehn <a.rehn@menlosystems.com>
commit37cd0af8110396eb5cf85b864b7c6fc4cb486c37
parent64f4228f66db4dd1eed8a9c6507d73c146419f08
authorMagdalena Stojek <magdalena.stojek@qt.io>
committerMagdalena Stojek <magdalena.stojek@qt.io>
commit timeMon, 12 Oct 2026 10:43:33 +0000