Distinguish between expanded and unexpanded icon state in Marble's Files View
completed by: Levente Kurusa
mentors: Torsten Rahn, Dennis Nienhüser
The TreeViewDecoratorModel acts as a proxy model between GeoDataTreeModel and a QTreeView to filter certain objects. Extend it to send different icons to the view based on whether a node is expanded or not.
- Introduce a slot updateExpansionState( const QModelIndex &index ) in TreeViewDecoratorModel. Keep an appropriate data structure as a member of TreeViewDecoratorModel to track the expansion state (a QSet, QVector or QList of QModelIndex or QPersistentModelIndex). The data structure should keep all expanded items and assume the rest are unexpaned, or vice versa
- Connect the expanded signal of QTreeView to the new slot in FileViewWidget
- Override the data method of TreeViewDecoratorModel. If data for an index is requested with the Qt::DecorationRole role and the internal data structure of expanded items contains the corresponding index (note: Be sure to compare QModelIndexes in the right model, and map to / from source as appropriate!), determine if there is a custom icon in the liststyle that needs to be returned. If yes, return it. Otherwise in any case, return whatever QSortFilterProxyModel::data() computes
- Check the implementation with a .kml file that contains a custom liststyle. Expanded/Unexpanded icons defined there should show up correctly in the Files panel. Submit a review request.