[PyQt] PyQt API 2: equivalent of Null QVariant?
paratribulations at free.fr
Tue Dec 21 20:06:11 GMT 2010
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 work
> 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 empty
> unicode object (although None is converted to a null QString when going in
> the other direction). I chose this asymmetric behaviour because QString()
> 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 said.
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.
More information about the PyQt