On Donnerstag, 7. November 2019 19:32:22 CET Dirk Hohndel wrote: > > On Nov 7, 2019, at 10:10 AM, Berthold Stoeger <bstoe...@mail.tuwien.ac.at> > > wrote: > > This all works on desktop, so my idea would be to use the desktop tree > > model and the desktop undo commands. More details later (in the metro to > > dinner). > 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. Berthold _______________________________________________ subsurface mailing list subsurface@subsurface-divelog.org http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface