agateau at kde.org
Mon Oct 22 13:48:33 BST 2012
Le dimanche 21 octobre 2012 13:49:49 David Faure a écrit :
> I don't think we want to call a full cmp().
> If you have two KFileItems referring to the same file, but one KFileItem has
> more details than the other (e.g. because it comes from KIO while the other
> one was created from a URL only), then cmp() will say false, but they are
> still about the same item.
> In other words:
> * operator== is for QSet/QHash, should return true "if this is about the
> same item".
> * cmp() is full comparison of all details, useful in KDirLister after an
> update (re-listing a directory), to find out if any detail has changed.
That is very interesting, I was not aware of those subtleties. I think it
would make a lot of sense to add what you wrote to KFileItem documentation.
The current cmp() doc explains a bit about the d-pointer difference with
operator==, but having usage guidelines like "operator== is for..., cmp() is
for..." would be great.
More information about the kde-core-devel