[PyQt] PyQt5 NULL QVariant

Phil Thompson phil at riverbankcomputing.com
Sat May 14 19:22:31 BST 2016


On 11 May 2016, at 1:21 pm, Matthias Kuhn <matthias at opengis.ch> wrote:
> 
> On 05/05/2016 09:21 AM, Phil Thompson wrote:
>> On 4 May 2016, at 10:41 pm, Matthias Kuhn <matthias at opengis.ch> wrote:
>>> Hi Phil
>>>> 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?
>>> Just wondering about the status of this. It's quite important for us to
>>> be able to plan ahead.
>>> 
>>> * Can we expect it with PyQt 5.7?
>> I haven't decided yet.
> 
> I just found the great pyqt5_register_from_qvariant_convertor API and it
> seems to work. So I guess we can even make this compatible with older
> versions and without upstream changes.
> Do you see any drawbacks from such an approach?

It depends - I don't know anything about OpenGIS or what part Python plays.

Your appproach will change behaviour of PyQt. If your application is a closed system, ie. it's not used with external code or user written code then that probably doesn't matter.

However if your code is an extension module that is used as part of the user's application then it is a really bad idea. Their code will behave in one way before your module is imported, and a different way afterwards.

Phil


More information about the PyQt mailing list