<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Hi,<br>
<br>
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.<br>
<br>
The documentation is not very verbose on this topic:<br>
<br>
<span style="color: rgb(0, 0, 0); font-size: 12px; font-style:
normal; font-variant: normal; font-weight: normal; letter-spacing:
normal; line-height: 15.6px; text-align: justify; text-indent:
0px; text-transform: none; white-space: normal; widows: 1;
word-spacing: 0px; display: inline ! important; float: none;
background-color: rgb(255, 255, 255);">PyQt5 does not support the<span
class="Apple-converted-space"> </span></span><code
class="docutils literal" style="color: rgb(0, 0, 0); font-size:
12px; font-style: normal; font-variant: normal; font-weight:
normal; letter-spacing: normal; line-height: 15.6px; orphans:
auto; text-align: justify; text-indent: 0px; text-transform: none;
white-space: normal; widows: 1; word-spacing: 0px;
-webkit-text-stroke-width: 0px; background-color: rgb(255, 255,
255);"><span class="pre">QPyNullVariant</span></code><span
style="color: rgb(0, 0, 0); font-family: 'Times New Roman';
font-size: 12px; font-style: normal; font-variant: normal;
font-weight: normal; letter-spacing: normal; line-height: 15.6px;
orphans: auto; text-align: justify; text-indent: 0px;
text-transform: none; white-space: normal; widows: 1;
word-spacing: 0px; -webkit-text-stroke-width: 0px; display: inline
!important; float: none; background-color: rgb(255, 255, 255);"><span
class="Apple-converted-space"> </span>class as it is no longer
needed.</span><br>
<a class="moz-txt-link-freetext" href="http://pyqt.sourceforge.net/Docs/PyQt5/pyqt_qvariant.html">http://pyqt.sourceforge.net/Docs/PyQt5/pyqt_qvariant.html</a><br>
<br>
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.<br>
<br>
What is the proper way of handling this?<br>
<br>
I.e. how can I tell if a QVariant is<br>
* Invalid<br>
* Valid but Null (with or without type information)<br>
* Valid (plus value and type)<br>
<br>
Matthias<br>
<p><span style="color: rgb(0, 0, 0); font-family: 'Times New Roman';
font-size: 12px; font-style: normal; font-variant: normal;
font-weight: normal; letter-spacing: normal; line-height:
15.6px; orphans: auto; text-align: justify; text-indent: 0px;
text-transform: none; white-space: normal; widows: 1;
word-spacing: 0px; -webkit-text-stroke-width: 0px; display:
inline !important; float: none; background-color: rgb(255, 255,
255);"></span></p>
</body>
</html>