mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Context menu 'Delete All Well Paths'
p4#: 22354
This commit is contained in:
@@ -1057,3 +1057,25 @@ void RimUiTreeModelPdm::setObjectToggleStateForSelection(QModelIndexList selecte
|
||||
}*/
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimUiTreeModelPdm::deleteAllWellPaths(const QModelIndex& itemIndex)
|
||||
{
|
||||
if (!itemIndex.isValid()) return;
|
||||
|
||||
caf::PdmUiTreeItem* uiItem = getTreeItemFromIndex(itemIndex);
|
||||
if (!uiItem) return;
|
||||
|
||||
caf::PdmObject* object = uiItem->dataObject().p();
|
||||
RimWellPathCollection* wellPathCollection = dynamic_cast<RimWellPathCollection*>(object);
|
||||
if (!wellPathCollection) return;
|
||||
|
||||
// Remove item from UI tree model before delete of project data structure
|
||||
removeRows_special(0, uiItem->childCount(), itemIndex);
|
||||
|
||||
wellPathCollection->wellPaths.deleteAllChildObjects();
|
||||
|
||||
clearClipboard();
|
||||
}
|
||||
|
||||
|
||||
@@ -55,6 +55,7 @@ public:
|
||||
bool deleteReservoirView(const QModelIndex& itemIndex);
|
||||
void deleteInputProperty(const QModelIndex& itemIndex);
|
||||
void deleteReservoir(RimCase* reservoir);
|
||||
void deleteAllWellPaths(const QModelIndex& itemIndex);
|
||||
|
||||
RimCellPropertyFilter* addPropertyFilter(const QModelIndex& itemIndex, QModelIndex& insertedModelIndex);
|
||||
RimCellRangeFilter* addRangeFilter(const QModelIndex& itemIndex, QModelIndex& insertedModelIndex);
|
||||
|
||||
@@ -220,6 +220,10 @@ void RimUiTreeView::contextMenuEvent(QContextMenuEvent* event)
|
||||
menu.addAction(QString("Add Script Path"), this, SLOT(slotAddScriptPath()));
|
||||
menu.addAction(QString("Delete Script Path"), this, SLOT(slotDeleteScriptPath()));
|
||||
}
|
||||
else if (dynamic_cast<RimWellPathCollection*>(uiItem->dataObject().p()))
|
||||
{
|
||||
menu.addAction(QString("Delete All Well Paths"), this, SLOT(slotDeleteAllWellPaths()));
|
||||
}
|
||||
|
||||
// Execute script on selection of cases
|
||||
RiuMainWindow* ruiMainWindow = RiuMainWindow::instance();
|
||||
@@ -1639,3 +1643,16 @@ void RimUiTreeView::appendScriptItems(QMenu* menu, RimScriptCollection* scriptCo
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimUiTreeView::slotDeleteAllWellPaths()
|
||||
{
|
||||
RimUiTreeModelPdm* myModel = dynamic_cast<RimUiTreeModelPdm*>(model());
|
||||
if (myModel)
|
||||
{
|
||||
myModel->deleteAllWellPaths(currentIndex());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -101,6 +101,8 @@ private slots:
|
||||
void slotToggleItemsOn();
|
||||
void slotToggleItemsOff();
|
||||
|
||||
void slotDeleteAllWellPaths();
|
||||
|
||||
signals:
|
||||
void selectedObjectChanged( caf::PdmObject* pdmObject );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user