why do we have a root item for DiveItem

Tomaz Canabrava tcanabrava at kde.org
Thu Apr 25 14:55:26 PDT 2013


Dirk,

To remove them from the table do:

beginRemoveRows(rootItem, first, last) ;

Code do call the cleaning of the subsurface data structures here

endRemoveRows() ;

This is of course in a method that doesn't exists yet on the model.

Só, action close triggered ()
{
Model->this-method-above() n
}

Programming and cellphones over emails are not fun.
Em 25/04/2013 18:00, "Dirk Hohndel" <dirk at hohndel.org> escreveu:

>
> On Thu, 2013-04-25 at 17:27 -0300, Tomaz Canabrava wrote:
> > 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.
>
> Just remember, Subsurface has this oddity:
>
> Trip
>    Dive
>    Dive
>    Dive
> Trip
>    Dive
> Dive (!!!) <- dives can be at the top level
> Dive
> Trip
>    Dive
>
> And then when you sort by any other column, the trips disappear and all
> you get is dives.
>
> Over lunch I tried to call model->sort(0, Qt:DescendingOrder), hoping
> this would do what I thought it would do (reorder the list). Clearly I
> was wrong :-)
>
> The other thing I played with was making on_actionClose_triggered() do
> the right thing (i.e. BEFORE it frees all the dives in the table
> actually remove them from the model... I couldn't get that to work,
> either.
>
> 30 minutes spent. Actual progress ZERO.
>
> Hooray for Qt/C++ :-)
>
> /D
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.hohndel.org/pipermail/subsurface/attachments/20130425/1675e0ea/attachment-0001.html>


More information about the subsurface mailing list