Expand up to root when creating a view. Removed use of expandAll()

p4#: 21353
This commit is contained in:
Magne Sjaastad
2013-04-22 10:04:37 +02:00
parent bd211d2115
commit 79e7d3604c
4 changed files with 29 additions and 8 deletions

View File

@@ -543,7 +543,11 @@ void RimUiTreeView::slotAddView()
QModelIndex insertedIndex;
myModel->addReservoirView(index, insertedIndex);
// Expand parent collection and inserted view item
setExpandedUpToRoot(insertedIndex);
setCurrentIndex(insertedIndex);
}
//--------------------------------------------------------------------------------------------------
@@ -827,6 +831,8 @@ void RimUiTreeView::slotNewStatisticsCase()
QModelIndex insertedIndex;
RimStatisticsCase* newObject = myModel->addStatisticalCalculation(currentIndex(), insertedIndex);
setCurrentIndex(insertedIndex);
setExpanded(insertedIndex, true);
}
}
@@ -1275,3 +1281,17 @@ void RimUiTreeView::storeTreeViewStateToString(QString& treeViewState)
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimUiTreeView::setExpandedUpToRoot(const QModelIndex& itemIndex)
{
QModelIndex mi = itemIndex;
while (mi.isValid())
{
this->setExpanded(mi, true);
mi = mi.parent();
}
}