From ce95ed8047dfc1dd763ef5ba7b01b88204f8b63f Mon Sep 17 00:00:00 2001 From: wmayer Date: Thu, 4 Nov 2021 23:21:14 +0100 Subject: [PATCH] PD: [skip ci] open a transaction when creating a new body with DlgActiveBody --- src/Mod/PartDesign/Gui/DlgActiveBody.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Mod/PartDesign/Gui/DlgActiveBody.cpp b/src/Mod/PartDesign/Gui/DlgActiveBody.cpp index 9aeb1b6c36..fb4841d94f 100644 --- a/src/Mod/PartDesign/Gui/DlgActiveBody.cpp +++ b/src/Mod/PartDesign/Gui/DlgActiveBody.cpp @@ -28,6 +28,7 @@ # include #endif +#include #include #include "DlgActiveBody.h" @@ -92,10 +93,15 @@ void DlgActiveBody::accept() App::DocumentObject* selectedBody = selectedItems[0]->data(Qt::UserRole).value(); - if (selectedBody) + if (selectedBody) { activeBody = makeBodyActive(selectedBody, _doc); - else + } + else { + // A transaction must be created as otherwise the undo/redo is broken + App::GetApplication().setActiveTransaction(QT_TRANSLATE_NOOP("Command", "Add a Body"), true); activeBody = makeBody(_doc); + App::GetApplication().closeActiveTransaction(); + } QDialog::accept(); }