Berthold, > On Nov 7, 2019, at 12:14 PM, Berthold Stoeger <[email protected]> > wrote: >> Yes, I looked at using the tree model and the undo commands. I actually >> spent quite a bit of time on that path before doing the current rewrite >> that is now in beta test on both Android and iOS. >> >> My conclusion is that it would be much easier to just kill the current >> mobile code completely and start from scratch writing an html/JS UI or >> native Java code for Android and Swift for iOS or something. Because QML >> cannot reasonably deal with data in tree models. > > It doesn't have to. Just like you defined a proxy model on top of the > DiveListModel, one could implement a proxy model on top of the tree model > that > "linearizes" it. Even though Qt's model API is bizarre (e.g. the empty range > is [0:-1]!), once you get the hang of it - it shouldn't be too hard. The > model > would return two kinds of items: trip and dive. Collapsing and expanding a > trip simply means removing/adding the corresponding second-level items with > the appropriate Qt model operations. I'll be busy tomorrow, but if you can > wait that long I can try to come up with a prototype during weekend. > > Thus, there would be no need to do any extra trip handling.
Interesting. I hadn't considered a linear model as proxy to a tree model. Or, more clearly put, I didn't think that was possible in the first place. I'm back home, nicely jetlagged... I'll spend some time reading the tree model code to see how this would work - happy to look at this as a better way to deal with trips on mobile. I would be rather surprised if was able to get anything useful done on this in the next couple of days, but if I surprise myself I'll let you know. Otherwise I'll be thrilled to look at prototype code from you :-) /D _______________________________________________ subsurface mailing list [email protected] http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
