16class RelocateArrangerObjectCommand :
public QUndoCommand
19 RelocateArrangerObjectCommand (
20 structure::arrangement::ArrangerObjectUuidReference region_ref,
23 : QUndoCommand (QObject::tr (
"Relocate Object")),
24 obj_ref_ (std::move (region_ref)), target_owner_ (target_owner),
25 source_owner_ (source_owner)
28 !std::ranges::contains (
29 source_owner_.get_children_vector (), obj_ref_.id (),
30 &structure::arrangement::ArrangerObjectUuidReference::id))
32 throw std::invalid_argument (
"Source owner does not include the object");
39 auto region_ref = target_owner_.remove_object (obj_ref_.id ());
40 source_owner_.add_object (region_ref);
45 auto region_ref = source_owner_.remove_object (obj_ref_.id ());
46 target_owner_.add_object (region_ref);
50 structure::arrangement::ArrangerObjectUuidReference obj_ref_;