[patch] klineedit: use isEmpty()

Allen Winter winter at kde.org
Tue Apr 8 20:53:37 BST 2008


On Tuesday 08 April 2008 06:19:41 Jaroslaw Staniek wrote:
> Andreas Hartmetz said the following, On 2008-04-08 10:04:
> > Haha, great. I read some QString code (*) to confirm my suspicion that
> > isNull() is just a deprecated way of saying isEmpty(). The thing is that
> > (shock) they actually differ! isNull() will check if the private class
> > instance is the shared null, isEmpty() will check for string length zero.
> > I conclude that QString::isNull() is Evil because in 99,5% of cases you
> > shouldn't care why and how a string is/has become empty.
> > (This is not news to many, I know)
> >
> > (*) the difference is actually documented, too :)
>
> Yeah, so what now? Time to inspect all the code for isNull() and change?
>
> Sometimes I also think about Krazy check for this...
>
> In fact I do pay attention to isEmpty()/isNull() differences, coming from
> the old Qt era, because I use both methods (on purpose) in database apps
> where we have heavy use of EMPTY and NULL properties, e.g. in Kexi.

I don't think the current Krazy can do this.  We need a real parser
to be able to detect QString::isNull from QPixmap::isNull from 
QDomNode::isNull, etc. etc.

I'll note the need for this check, but we'll have to wait for Krazy3 :)






More information about the kde-core-devel mailing list