[PyQt] PyQt5 NULL QVariant
Matthias Kuhn
matthias at opengis.ch
Mon Apr 18 13:27:23 BST 2016
Hi,
I am currently updating QGIS to PyQt5 (and Qt5 and Python3). Since this
update, NULL QVariant strings are converted to empty strings '' and all
numbers to 0 when converted from C++ to python objects.
The documentation is not very verbose on this topic:
PyQt5 does not support the |QPyNullVariant| class as it is no longer needed.
http://pyqt.sourceforge.net/Docs/PyQt5/pyqt_qvariant.html
sip.enableautoconversion() which is mentioned on the same doc page
probably does the job of preserving the semantics but at the same time
sacrifices all the advantages of PyQt4's v2 API.
What is the proper way of handling this?
I.e. how can I tell if a QVariant is
* Invalid
* Valid but Null (with or without type information)
* Valid (plus value and type)
Matthias
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20160418/fddae4bb/attachment.html>
More information about the PyQt
mailing list