wiRedPanda
Logic Circuit Simulator
Loading...
Searching...
No Matches
MorphCommand Class Reference

Undo command that changes the type of selected elements while preserving connections. More...

#include <Commands.h>

Inheritance diagram for MorphCommand:
[legend]

Public Member Functions

 MorphCommand (const QList< GraphicElement * > &elements, ElementType type, Scene *scene, QUndoCommand *parent=nullptr)
 Constructs the morph command.
void redo () override
 Replaces elements with instances of the new type.
void undo () override
 Restores the original element types.

Additional Inherited Members

Protected Member Functions inherited from ElementsCommand
QList< GraphicElement * > elements () const
 Returns the live element pointers for this command's targets, looked up by stored ID.
 ElementsCommand (const QList< GraphicElement * > &elements, Scene *scene, QUndoCommand *parent=nullptr)
Protected Attributes inherited from ElementsCommand
QList< int > m_ids
Scenem_scene

Detailed Description

Undo command that changes the type of selected elements while preserving connections.

Definition at line 285 of file Commands.h.

Constructor & Destructor Documentation

◆ MorphCommand()

MorphCommand::MorphCommand ( const QList< GraphicElement * > & elements,
ElementType type,
Scene * scene,
QUndoCommand * parent = nullptr )
explicit

Constructs the morph command.

Parameters
elementsElements to morph.
typeTarget element type.
sceneTarget scene.
parentOptional parent undo command.

Definition at line 693 of file Commands.cpp.

References ElementsCommand::elements(), and ElementsCommand::ElementsCommand().

Member Function Documentation

◆ redo()

void MorphCommand::redo ( )
override

Replaces elements with instances of the new type.

Definition at line 757 of file Commands.cpp.

References ElementFactory::buildElement(), ElementsCommand::elements(), ElementsCommand::m_ids, and ElementsCommand::m_scene.

◆ undo()

void MorphCommand::undo ( )
override

Restores the original element types.

Definition at line 734 of file Commands.cpp.

References ElementFactory::buildElement(), ElementsCommand::elements(), ElementsCommand::m_ids, and ElementsCommand::m_scene.


The documentation for this class was generated from the following files: