Code review comment for lp://qastaging/~uriboni/webbrowser-app/newtabview-listviews

Revision history for this message
Olivier Tilloy (osomon) wrote :

This works, but is a rather complex implementation.

I’ve taken a stab at something much simpler that doesn’t involve aggregator models: the idea is to use a SortFilterModel indeed to sort bookmarks by folder, but instead of filtering out bookmarks for which the folder is collapsed (which as you pointed out wouldn’t work because the corresponding section wouldn’t be displayed by the list view), I’m keeping track of expanded/collapsed state of each section in a separate dictionary, and delegates in the list view are visible or not depending on that state.

This results in much simpler code, with no need for custom C++ models, all is done in QML.

The only thing that this doesn’t achieve, afaict, is prepending the homepage to the model as a hardcoded bookmark. I’ve been thinking about that, and in fact I think modifying the model is the wrong approach. We can leverage the 'header' property of ListView to display a first hardcoded item that’s not in the model.

See a fully functional standalone example at http://pastebin.ubuntu.com/13009316/.
Comments welcome.

« Back to merge proposal