CommandHierarchyItemRename.h 930 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #pragma once
  9. #include <QUndoCommand>
  10. class CommandHierarchyItemRename
  11. : public QUndoCommand
  12. {
  13. public:
  14. void undo() override;
  15. void redo() override;
  16. static void Push(UndoStack* stack,
  17. HierarchyWidget* hierarchy,
  18. const AZ::EntityId& entityId,
  19. const QString& fromName,
  20. const QString& toName);
  21. private:
  22. CommandHierarchyItemRename(UndoStack* stack,
  23. HierarchyWidget* hierarchy,
  24. const AZ::EntityId& entityId,
  25. const QString& fromName,
  26. const QString& toName);
  27. void SetName(const QString& name) const;
  28. UndoStack* m_stack;
  29. HierarchyWidget* m_hierarchy;
  30. AZ::EntityId m_id;
  31. QString m_from;
  32. QString m_to;
  33. };