mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Expand up to root when creating a view. Removed use of expandAll()
p4#: 21353
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user