diff --git a/sources/conductorautonumerotation.cpp b/sources/conductorautonumerotation.cpp index de0e65062..005266b5f 100644 --- a/sources/conductorautonumerotation.cpp +++ b/sources/conductorautonumerotation.cpp @@ -66,12 +66,25 @@ void ConductorAutoNumerotation::applyText(QString t) cp.text = t; new_value.setValue(cp); - QPropertyUndoCommand *undo = new QPropertyUndoCommand(m_conductor, "properties", old_value, new_value, m_parent_undo); - undo->setText(QObject::tr("Modifier les propriétés d'un conducteur", "undo caption")); + QUndoCommand *undo = nullptr; + + if (m_parent_undo) + { + new QPropertyUndoCommand(m_conductor, "properties", old_value, new_value, m_parent_undo); + undo = m_parent_undo; + } + else + { + undo = new QUndoCommand(); + new QPropertyUndoCommand(m_conductor, "properties", old_value, new_value, undo); + undo->setText(QObject::tr("Modifier les propriétés d'un conducteur", "undo caption")); + } if (!conductor_list.isEmpty()) { - undo->setText(QObject::tr("Modifier les propriétés de plusieurs conducteurs", "undo caption")); + if (!m_parent_undo) + undo->setText(QObject::tr("Modifier les propriétés de plusieurs conducteurs", "undo caption")); + foreach (Conductor *cond, conductor_list) { ConductorProperties cp2 = cond -> properties(); diff --git a/sources/qetgraphicsitem/terminal.cpp b/sources/qetgraphicsitem/terminal.cpp index 07f13ffa6..41f6e013d 100644 --- a/sources/qetgraphicsitem/terminal.cpp +++ b/sources/qetgraphicsitem/terminal.cpp @@ -602,7 +602,9 @@ void Terminal::mouseReleaseEvent(QGraphicsSceneMouseEvent *e) } - QUndoCommand *undo = new AddItemCommand(new_conductor, diagram()); + QUndoCommand *undo = new QUndoCommand(); + QUndoCommand *aic = new AddItemCommand(new_conductor, diagram(), QPointF(), undo); + undo->setText(aic->text()); if (use_properties) {