]> Shamusworld >> Repos - architektonas/blobdiff - src/applicationwindow.cpp
Fixed delete key to delete selected objects.
[architektonas] / src / applicationwindow.cpp
index a9108eb5f6d3d2b5d96b5280b99e13652013f6ed..77767f0610ae2a32b9d2df941a48f1db2e97f5b1 100644 (file)
@@ -197,7 +197,17 @@ void ApplicationWindow::FixLength(void)
 // We want certain tools to be exclusive, and this approach isn't working correctly...
 void ApplicationWindow::DeleteTool(void)
 {
-       
+       // For this tool, we check first to see if anything is selected. If so, we
+       // delete those and *don't* select the delete tool.
+       if (drawing->document.ItemsSelected() > 0)
+       {
+               drawing->document.DeleteSelectedItems();
+               drawing->update();
+               deleteAct->setChecked(false);
+               return;
+       }
+
+       // Otherwise, toggle the state of the tool
        ClearUIToolStatesExcept(deleteAct);
        SetInternalToolStates();
 }
@@ -382,10 +392,13 @@ void ApplicationWindow::Settings(void)
 }
 
 
+//
+// Group a bunch of selected objects (which can include other groups) together
+// or ungroup a selected group.
+//
 void ApplicationWindow::HandleGrouping(void)
 {
-       // Group a bunch of selected objects together or ungroup a selected group.
-
+       // If nothing selected, do nothing
        if (drawing->document.ItemsSelected() == 0)
        {
                statusBar()->showMessage(tr("No objects selected to make a group from."));
@@ -451,7 +464,7 @@ void ApplicationWindow::CreateActions(void)
                QIcon(":/res/fix-length.png"), QKeySequence(tr("F,L")), true);
        connect(fixLengthAct, SIGNAL(triggered()), this, SLOT(FixLength()));
 
-       deleteAct = CreateAction(tr("&Delete"), tr("Delete Object"), tr("Deletes selected objects."), QIcon(":/res/delete-tool.png"), QKeySequence(), true);
+       deleteAct = CreateAction(tr("&Delete"), tr("Delete Object"), tr("Deletes selected objects."), QIcon(":/res/delete-tool.png"), QKeySequence(tr("Delete")), true);
        connect(deleteAct, SIGNAL(triggered()), this, SLOT(DeleteTool()));
 
        addDimensionAct = CreateAction(tr("Add &Dimension"), tr("Add Dimension"), tr("Adds a dimension to the drawing."), QIcon(":/res/dimension-tool.png"), QKeySequence("D,I"), true);