void MshView::removeMesh() { QModelIndex index (this->selectionModel()->currentIndex()); if (!index.isValid()) OGSError::box("No mesh selected."); else { emit requestMeshRemoval(index); emit enableSaveButton(false); emit enableRemoveButton(false); } }
void MshView::selectionChanged( const QItemSelection &selected, const QItemSelection &deselected ) { Q_UNUSED(deselected); if (!selected.isEmpty()) { emit removeSelectedMeshComponent(); const QModelIndex idx = *(selected.indexes().begin()); const TreeItem* tree_item = static_cast<TreeModel*>(this->model())->getItem(idx); const MshItem* list_item = dynamic_cast<const MshItem*>(tree_item); if (list_item) { emit enableSaveButton(true); emit enableRemoveButton(true); emit meshSelected(*list_item->getMesh()); } else { emit enableSaveButton(false); emit enableRemoveButton(false); emit elementSelected(dynamic_cast<const MshItem*>(tree_item->parentItem())->vtkSource(), static_cast<unsigned>(tree_item->row()), true); } } }
void StationTreeView::removeStationList() { QModelIndex index (this->selectionModel()->currentIndex()); if (!index.isValid()) OGSError::box("No station list selected."); else { TreeItem* item = static_cast<StationTreeModel*>(model())->getItem(index); emit stationListRemoved((item->data(0).toString()).toStdString()); if(this->selectionModel()->selectedIndexes().count() == 0) { emit enableSaveButton(false); emit enableRemoveButton(false); } } }
void GeoTreeView::removeGeometry() { QModelIndex index (this->selectionModel()->currentIndex()); if (!index.isValid()) OGSError::box("No geometry selected."); else { TreeItem* item = static_cast<GeoTreeModel*>(model())->getItem(index); GeoObjectListItem* list = dynamic_cast<GeoObjectListItem*>(item); if (list) emit listRemoved((item->parentItem()->data( 0).toString()).toStdString(), list->getType()); else emit listRemoved((item->data(0).toString()).toStdString(), GeoLib::GEOTYPE::INVALID); if(this->selectionModel()->selectedIndexes().count() == 0) { emit enableSaveButton(false); emit enableRemoveButton(false); } } }