[PyQt] PyQt API 2: equivalent of Null QVariant?
phil at riverbankcomputing.com
Tue Dec 21 22:14:49 GMT 2010
On Tue, 21 Dec 2010 21:06:11 +0100, TP <paratribulations at free.fr> wrote:
> Phil Thompson wrote:
>> The short answer is that you can't. However...
>> QVariant::isNull() typically delegates to the enclosed data's isNull()
>> method (eg. QString::isNull()). So your example for API v1 will also
>> for API v2.
>> It gets a bit more complicated if you are also using the QString v2 API
>> because a null QString and an empty QString are both converted to an
>> unicode object (although None is converted to a null QString when going
>> the other direction). I chose this asymmetric behaviour because
>> creates a null QString when often what is really meant is an empty
> Thanks for your answer.
> I have checked that API2 for QVariant works by using isNull() as you
> But, I cannot use API2 for QString.
> This means that I must stick to API1 for QString, at least.
> Will API1 support be continued in the next versions of PyQt?
> Indeed, detecting NULL is for me very important.
API v1 will be supported until PyQt5 or Python v4.
More information about the PyQt