qobject2qvariant flags

Add flags in qobject2qvariant() allowing to decide if Null and Invalid
variants should be generated. This can be used to generate more compact
JSON structures.