project: implemented the ability to delete items from projects
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user