QModelIndexList NickView::selectedIndexes() const { QModelIndexList indexList = TreeViewTouch::selectedIndexes(); // make sure the item we clicked on is first if (indexList.contains(currentIndex())) { indexList.removeAll(currentIndex()); indexList.prepend(currentIndex()); } return indexList; }
void DirTreeView::closeAllExcept( const QModelIndex & branch ) { QModelIndexList branchesToClose = expandedIndexes(); // Remove all ancestors of 'branch' from branchesToClose QModelIndex index = branch; while ( index.isValid() ) { // logDebug() << "Not closing " << index << endl; branchesToClose.removeAll( index ); index = index.parent(); } // Close all items in branchesToClose foreach ( index, branchesToClose ) { // logDebug() << "Closing " << index << endl; collapse( index ); }