[patch] klineedit: use isEmpty()

Andreas Hartmetz ahartmetz at gmail.com
Tue Apr 8 09:04:25 BST 2008


Am Dienstag, 8. April 2008 00:09:33 schrieb Jaroslaw Staniek:
> David Faure said the following, On 2008-04-06 23:44:
> > On Thursday 03 April 2008, Jarosław Staniek wrote:
> >> for review: no idea why input.isNull() was used, perhaps there's a
> >> reason?
> >
> > Then why change it?
>
> To make the code work as expected when input == "" ?

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 :)

-- 
What a pinhead! Does he not fear us?!




More information about the kde-core-devel mailing list