[PyQt] PyQt5 NULL QVariant

Matthias Kuhn matthias at opengis.ch
Fri Apr 22 06:52:00 BST 2016


On 04/21/2016 05:59 PM, Phil Thompson wrote:
>> Which I think are properly addressed by introducing the
>> sip.enableautoconversion() function to allow turning autoconversion off.
>> But I struggle to see why this requires breaking compatiblity with SIP
>> API V2 if autoconversion is turned on.
> Maybe I'm not understanding. Apart from QPyNullVariant not being implemented (which was a hack), what has broken?

If there is a QVariantList with [ 1, QVariant( QVariant::Int ), 0 ] it's
converted to a python list [1, 0, 0] and hence the semantic of NULL
values is lost. This is probably caused by the lack of QPyNullVariant
but it breaks compatibility with sip api v2 code. I don't think a
non-hacky replacement for QPyNullVariant has been introduced (apart from
disabling autoconversion) or am I missing something?

Matthias


More information about the PyQt mailing list