[PyQt] PyQt5 NULL QVariant

Phil Thompson phil at riverbankcomputing.com
Fri Apr 22 09:52:35 BST 2016


On 22 Apr 2016, at 6:52 am, Matthias Kuhn <matthias at opengis.ch> wrote:
> 
> 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?

No you're not. I can see that the loss of QPyNullVariant can be inconvenient when dealing with C++ code that makes significant use of Null QVariants. However adding it back would itself be a break in compatibility. I'm happy to consider that but it wouldn't be until PyQt v5.7 at the earliest - unless you can think of another solution?

Phil


More information about the PyQt mailing list