From 94a3451b873bd2df18811959bfa10f0579519f0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole-Andr=C3=A9=20Rodlie?= Date: Fri, 14 Aug 2026 17:25:34 +0200 Subject: [PATCH] UX: refactor Duplicate action --- src/core/canvas.cpp | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/src/core/canvas.cpp b/src/core/canvas.cpp index 2ee44f5e8..292392324 100644 --- a/src/core/canvas.cpp +++ b/src/core/canvas.cpp @@ -1194,8 +1194,31 @@ void Canvas::splitAction() void Canvas::duplicateAction() { - copyAction(); - pasteAction(); + if (mSelectedBoxes.isEmpty()) { return; } + + const auto originals = mSelectedBoxes.getList(); + clearBoxesSelection(); + + for (auto* box : originals) { + if (!box) continue; + + ContainerBox* targetContainer = box->getParentGroup(); + if (!targetContainer) { targetContainer = mCurrentContainer; } + + const int originalZIndex = box->getZIndex(); + const QString originalName = box->prp_getName(); + + QList singleList; + singleList.append(box); + + const auto tempClipboard = enve::make_shared(singleList); + tempClipboard->pasteTo(targetContainer); + + if (mLastSelectedBox && mLastSelectedBox != box) { + mLastSelectedBox->moveTo(originalZIndex); + mLastSelectedBox->prp_setName(originalName + " Copy"); + } + } } void Canvas::selectAllAction()