Disable deletion if a terminal can't be deleted.

In case of user try to delete a terminal element who is bridged
or belong to a physical terminal with more than one level, the deletion
is aborted to avoid mistake in the terminal strip parent of the terminal
element. A dialog is opened when the deletion can't be to explain to
user what to do for enable the deletion.
This commit is contained in:
joshua
2025-07-24 22:24:15 +02:00
parent a121fbe530
commit 74b55f3bf5
5 changed files with 60 additions and 8 deletions

View File

@@ -1468,12 +1468,21 @@ void QETDiagramEditor::selectionGroupTriggered(QAction *action)
if (!dv || value.isEmpty()) return;
if (value == "delete_selection")
{
diagram->clearSelection();
diagram->undoStack().push(new DeleteQGraphicsItemCommand(diagram, dc));
dv->adjustSceneRect();
}
if (value == "delete_selection")
{
if (DeleteQGraphicsItemCommand::hasNonDeletableTerminal(dc)) {
QET::QetMessageBox::information(this,
tr("Suppression de borne impossible"),
tr("La suppression ne peut être effectué car la selection "
"possède une ou plusieurs bornes ponté et/ou appartenant à une borne à niveau multiple.\n"
"Déponter et/ou supprimer les niveaux des bornes concerné "
"afin de pouvoir les supprimer"));
} else {
diagram->clearSelection();
diagram->undoStack().push(new DeleteQGraphicsItemCommand(diagram, dc));
dv->adjustSceneRect();
}
}
else if (value == "rotate_selection")
{
RotateSelectionCommand *c = new RotateSelectionCommand(diagram);