[PyQt] PyQt5 NULL QVariant

Matthias Kuhn matthias at opengis.ch
Sun May 15 07:06:19 BST 2016


On 14/05/16 20:22, Phil Thompson wrote:
> On 11 May 2016, at 1:21 pm, Matthias Kuhn <matthias at opengis.ch> wrote:
>> 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.
QGIS is two things, a desktop application for which python plugins can
be written and a library which can be used in standalone applications.

The requirement to `import qgis` first applied already with PyQt4 to set
the sip api version, so all code should already be prepared for this.
The requirement is already a bit relaxed actually because now the import
does no longer strictly need to happen before any PyQt imports.

I will be happy to lift this requirement, feel free to integrate my code
directly in PyQt.

Matthias


More information about the PyQt mailing list