// 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();
}
}
+//
+// 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."));
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);