ReparentCategoryCommand.h header

#include <ew/core/ReparentCategoryCommand.h>

Namespace ew::core

ReparentCategoryCommand class

class ew::core::ReparentCategoryCommand

Command that moves a category to a new parent (a null parent id makes it a root), through Taxonomy::reparent – which rejects a move that is unknown or would create a cycle, in which case this command changes nothing. Undo restores the previous parent; redo re-applies the move.

Members

ew::core::ReparentCategoryCommand::ReparentCategoryCommand(Taxonomy &taxonomy, CategoryId id, CategoryId newParent)

Creates a command that reparents category id in taxonomy under newParent.

ew::core::ReparentCategoryCommand::~ReparentCategoryCommand() override

Destroys the command.

void ew::core::ReparentCategoryCommand::apply() override

Records the current parent and reparents to the new one (a no-op if the move is rejected).

void ew::core::ReparentCategoryCommand::undo() override

Restores the previous parent (only when apply() actually moved the category).

QString ew::core::ReparentCategoryCommand::description() const override

Returns a short description for the undo/redo UI.