mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Create UI tree items and insert in parent when opening new cases from file. Avoid building the complete tree using onProjectOpenedOrClosed()
p4#: 21357
This commit is contained in:
parent
e1b778d17f
commit
8c28e8ff6c
@ -518,7 +518,13 @@ bool RiaApplication::openEclipseCase(const QString& caseName, const QString& cas
|
|||||||
riv->cellResult()->resultVariable = RimDefines::undefinedResultName();
|
riv->cellResult()->resultVariable = RimDefines::undefinedResultName();
|
||||||
}
|
}
|
||||||
|
|
||||||
onProjectOpenedOrClosed();
|
RimUiTreeModelPdm* uiModel = RiuMainWindow::instance()->uiPdmModel();
|
||||||
|
caf::PdmUiTreeItem* projectTreeItem = uiModel->treeItemRoot();
|
||||||
|
|
||||||
|
// New case is inserted before the last item, the script item
|
||||||
|
int position = projectTreeItem->childCount() - 1;
|
||||||
|
|
||||||
|
uiModel->addToParentAndBuildUiItems(projectTreeItem, position, rimResultReservoir);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -547,7 +553,13 @@ bool RiaApplication::openInputEclipseCase(const QString& caseName, const QString
|
|||||||
riv->cellResult()->resultVariable = RimDefines::undefinedResultName();
|
riv->cellResult()->resultVariable = RimDefines::undefinedResultName();
|
||||||
}
|
}
|
||||||
|
|
||||||
onProjectOpenedOrClosed();
|
RimUiTreeModelPdm* uiModel = RiuMainWindow::instance()->uiPdmModel();
|
||||||
|
caf::PdmUiTreeItem* projectTreeItem = uiModel->treeItemRoot();
|
||||||
|
|
||||||
|
// New case is inserted before the last item, the script item
|
||||||
|
int position = projectTreeItem->childCount() - 1;
|
||||||
|
|
||||||
|
uiModel->addToParentAndBuildUiItems(projectTreeItem, position, rimInputReservoir);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -883,3 +883,22 @@ RimIdenticalGridCaseGroup* RimUiTreeModelPdm::gridCaseGroupFromItemIndex(const Q
|
|||||||
return gridCaseGroup;
|
return gridCaseGroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void RimUiTreeModelPdm::addToParentAndBuildUiItems(caf::PdmUiTreeItem* parentTreeItem, int position, caf::PdmObject* pdmObject)
|
||||||
|
{
|
||||||
|
QModelIndex parentModelIndex;
|
||||||
|
|
||||||
|
if (parentTreeItem && parentTreeItem->dataObject())
|
||||||
|
{
|
||||||
|
parentModelIndex = getModelIndexFromPdmObject(parentTreeItem->dataObject());
|
||||||
|
}
|
||||||
|
|
||||||
|
beginInsertRows(parentModelIndex, position, position);
|
||||||
|
|
||||||
|
caf::PdmUiTreeItem* childItem = caf::UiTreeItemBuilderPdm::buildViewItems(parentTreeItem, position, pdmObject);
|
||||||
|
|
||||||
|
endInsertRows();
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -61,6 +61,8 @@ public:
|
|||||||
RimReservoirView* addReservoirView(const QModelIndex& itemIndex, QModelIndex& insertedModelIndex);
|
RimReservoirView* addReservoirView(const QModelIndex& itemIndex, QModelIndex& insertedModelIndex);
|
||||||
void addInputProperty(const QModelIndex& itemIndex, const QStringList& fileNames);
|
void addInputProperty(const QModelIndex& itemIndex, const QStringList& fileNames);
|
||||||
|
|
||||||
|
void addToParentAndBuildUiItems(caf::PdmUiTreeItem* parentTreeItem, int position, caf::PdmObject* pdmObject);
|
||||||
|
|
||||||
void addObjects(const QModelIndex& itemIndex, caf::PdmObjectGroup& pdmObjects);
|
void addObjects(const QModelIndex& itemIndex, caf::PdmObjectGroup& pdmObjects);
|
||||||
void moveObjects(const QModelIndex& itemIndex, caf::PdmObjectGroup& pdmObjects);
|
void moveObjects(const QModelIndex& itemIndex, caf::PdmObjectGroup& pdmObjects);
|
||||||
|
|
||||||
@ -84,7 +86,6 @@ private slots:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void clearClipboard();
|
void clearClipboard();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QFileSystemWatcher* m_scriptChangeDetector;
|
QFileSystemWatcher* m_scriptChangeDetector;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user