#3720 Temp LGR. Hide 'Temporary LGRs' tree node when no temp LGRs exist

This commit is contained in:
Bjørn Erik Jensen 2018-11-21 09:58:32 +01:00
parent 094ae45dcd
commit 651084420c
2 changed files with 22 additions and 1 deletions

View File

@ -476,7 +476,10 @@ void RimGridCollection::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrder
{
uiTreeOrdering.add(m_persistentLgrs());
}
uiTreeOrdering.add(m_temporaryLgrs());
if (hasTemporaryLgrs())
{
uiTreeOrdering.add(m_temporaryLgrs());
}
uiTreeOrdering.skipRemainingChildren(true);
}
@ -505,3 +508,20 @@ bool RimGridCollection::hasPersistentLgrs() const
}
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimGridCollection::hasTemporaryLgrs() const
{
auto mainGrid = this->mainGrid();
if (!mainGrid) return false;
for (size_t i = 1; i < mainGrid->gridCount(); i++)
{
const auto grid = mainGrid->gridByIndex(i);
if (grid->isTempGrid()) return true;
}
return false;
}

View File

@ -117,6 +117,7 @@ protected:
private:
const RigMainGrid* mainGrid() const;
bool hasPersistentLgrs() const;
bool hasTemporaryLgrs() const;
caf::PdmField<bool> m_isActive;
caf::PdmChildField<RimGridInfo*> m_mainGrid;