File indexing completed on 2024-09-08 10:59:26
0001 #include "undoCmd/anchorvmapitemcommand.h" 0002 #include "controller/item_controllers/visualitemcontroller.h" 0003 0004 0005 AnchorVMapItemCommand::AnchorVMapItemCommand(vmap::VisualItemController *child, vmap::VisualItemController *newParent) 0006 : m_child(child) 0007 { 0008 if(m_child) 0009 m_previousParent = m_child->parentUuid(); 0010 0011 if(newParent) 0012 m_parentId = newParent->uuid(); 0013 } 0014 0015 void AnchorVMapItemCommand::redo() 0016 { 0017 if(!m_child) 0018 return; 0019 0020 m_child->setParentUuid(m_parentId); 0021 } 0022 0023 void AnchorVMapItemCommand::undo() 0024 { 0025 if(!m_child) 0026 return; 0027 0028 m_child->setParentUuid(m_previousParent); 0029 }