mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-14 01:12:11 -05:00
Performance: Move selectedUiItems outside the for loop
When number of objects is quite large, this causes a huge performance penalty.
This commit is contained in:
1 parent
f1823da6d7
commit
bd0ef7f63b
1 file changed
+5
-3
@@ -591,6 +591,11 @@ bool PdmUiTreeViewEditor::updateSelectionManager()
|
||||
void PdmUiTreeViewEditor::updateItemDelegateForSubTree( const QModelIndex& subRootIndex /* = QModelIndex() */ )
|
||||
{
|
||||
auto allIndices = m_treeViewModel->allIndicesRecursive( subRootIndex );
|
||||
if ( allIndices.empty() ) return;
|
||||
|
||||
std::vector<PdmUiItem*> selection;
|
||||
selectedUiItems( selection );
|
||||
|
||||
for ( QModelIndex& index : allIndices )
|
||||
{
|
||||
QModelIndex filterIndex = m_filterModel->mapFromSource( index );
|
||||
@@ -609,9 +614,6 @@ void PdmUiTreeViewEditor::updateItemDelegateForSubTree( const QModelIndex& subRo
|
||||
PdmFieldReorderCapability* reorderability =
|
||||
PdmFieldReorderCapability::reorderCapabilityOfParentContainer( pdmObject );
|
||||
|
||||
std::vector<PdmUiItem*> selection;
|
||||
selectedUiItems( selection );
|
||||
|
||||
if ( reorderability && filterIndex.row() >= 0 && selection.size() == 1u && selection.front() == uiItem )
|
||||
{
|
||||
size_t indexInParentField = reorderability->indexOf( pdmObject );
|
||||
|
||||
Reference in new issue
Block a user