mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#3607 Grid items. Hide LGRs folder if there are no LGRs on file
This commit is contained in:
@@ -463,7 +463,10 @@ void RimGridCollection::initAfterRead()
|
|||||||
void RimGridCollection::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/)
|
void RimGridCollection::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/)
|
||||||
{
|
{
|
||||||
uiTreeOrdering.add(m_mainGrid());
|
uiTreeOrdering.add(m_mainGrid());
|
||||||
uiTreeOrdering.add(m_persistentLgrs());
|
if (hasPersistentLgrs())
|
||||||
|
{
|
||||||
|
uiTreeOrdering.add(m_persistentLgrs());
|
||||||
|
}
|
||||||
uiTreeOrdering.add(m_temporaryLgrs());
|
uiTreeOrdering.add(m_temporaryLgrs());
|
||||||
uiTreeOrdering.skipRemainingChildren(true);
|
uiTreeOrdering.skipRemainingChildren(true);
|
||||||
}
|
}
|
||||||
@@ -477,3 +480,19 @@ const RigMainGrid* RimGridCollection::mainGrid() const
|
|||||||
firstAncestorOrThisOfType(eclipseCase);
|
firstAncestorOrThisOfType(eclipseCase);
|
||||||
return eclipseCase ? eclipseCase->mainGrid() : nullptr;
|
return eclipseCase ? eclipseCase->mainGrid() : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool RimGridCollection::hasPersistentLgrs() const
|
||||||
|
{
|
||||||
|
auto mainGrid = this->mainGrid();
|
||||||
|
if (!mainGrid) return 0;
|
||||||
|
|
||||||
|
for (int i = 1; i < mainGrid->gridCount(); i++)
|
||||||
|
{
|
||||||
|
const auto grid = mainGrid->gridByIndex(i);
|
||||||
|
if (!grid->isTempGrid()) return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|||||||
@@ -116,6 +116,7 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
const RigMainGrid* mainGrid() const;
|
const RigMainGrid* mainGrid() const;
|
||||||
|
bool hasPersistentLgrs() const;
|
||||||
|
|
||||||
caf::PdmField<bool> m_isActive;
|
caf::PdmField<bool> m_isActive;
|
||||||
caf::PdmChildField<RimGridInfo*> m_mainGrid;
|
caf::PdmChildField<RimGridInfo*> m_mainGrid;
|
||||||
|
|||||||
Reference in New Issue
Block a user