project: implemented the ability to delete items from projects

This commit is contained in:
itsmattkc
2020-03-28 12:33:28 +11:00
parent a2a432a0e8
commit b54388894c
6 changed files with 69 additions and 7 deletions
@@ -406,3 +406,22 @@ void ProjectExplorer::DeselectAll()
{
CurrentView()->selectionModel()->clearSelection();
}
void ProjectExplorer::DeleteSelected()
{
QList<Item*> selected = SelectedItems();
if (selected.isEmpty()) {
return;
}
QUndoCommand* command = new QUndoCommand();
foreach (Item* item, selected) {
ItemPtr item_ptr = item->get_shared_ptr();
new ProjectViewModel::RemoveItemCommand(&model_, item_ptr, command);
}
Core::instance()->undo_stack()->pushIfHasChildren(command);
}