SetEntityCategoryCommand.h header

#include <ew/core/entity/SetEntityCategoryCommand.h>

Namespace ew::core::entity

SetEntityCategoryCommand class

class ew::core::entity::SetEntityCategoryCommand

Command that moves an entity into a different category (a null id leaves it uncategorised). Undo restores the previous category and redo re-applies the new one.

It restores the ADDITIONAL memberships too, because the move can change them: filing an entity under a category it already carried as a membership drops that membership (a category cannot be held twice), and an undo that put back only the primary would leave it lost.

Members

ew::core::entity::SetEntityCategoryCommand::SetEntityCategoryCommand(Entity &entity, ew::core::foundation::CategoryId categoryId)

Creates a command that files entity under category categoryId.

ew::core::entity::SetEntityCategoryCommand::~SetEntityCategoryCommand() override

Destroys the command.

void ew::core::entity::SetEntityCategoryCommand::apply() override

Records the entity's current category and sets the new one.

void ew::core::entity::SetEntityCategoryCommand::undo() override

Restores the previous category.

QString ew::core::entity::SetEntityCategoryCommand::description() const override

Returns a short description for the undo/redo UI.

ew::core::foundation::OperationSubject ew::core::entity::SetEntityCategoryCommand::subject() const override

Returns the subject this command changes. See Command::subject().