why do we have a root item for DiveItem

Tomaz Canabrava tcanabrava at kde.org
Thu Apr 25 13:27:43 PDT 2013


All models in Qt, by design, starts with an empty 'root' item that holds
all the items - in the case of list and table models, and holds all first
nodes, in the case of tree models (our case).

This 'root' item by no means requires it to be of the same type of its
children.

But if the underlying model of the subsurface datastructures are already
tree like, there's no need for items at all.

We need only a way to find the parent node from a children, and given a
children see if they have children's.

>From what I see on subsurface the dive list has just one depth
relationship, seems easy to make it.

Sorry for the strange email, answering by phone.
T
Em 25/04/2013 12:50, "Dirk Hohndel" <dirk at hohndel.org> escreveu:

>
> Tomaz
>
> Right now we have this odd root item that is created with the default
> constructor... I'm not quite sure what the purpose of it is... but I'd
> love to enforce that the struct dive *dive that we have in the DiveItem
> is always != NULL. Which of course I can't do with the default
> constructor...
>
> My first guess was that this is so that the destructor can get rid of
> all of the elements? If that's the case, then why not simply use the
> first DiveItem that is created as the root?
>
> Can you shed some light on this?
>
> Thanks
>
> /D
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.hohndel.org/pipermail/subsurface/attachments/20130425/a2e27e0a/attachment.html>


More information about the subsurface mailing list