Beispiel #1
0
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;
}
Beispiel #2
0
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 );
    }