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

Undo command that records a drag-move of a set of elements. More...

#include <Commands.h>

Inheritance diagram for MoveCommand:
[legend]

Public Member Functions

 MoveCommand (const QList< GraphicElement * > &list, const QList< QPointF > &oldPositions, Scene *scene, QUndoCommand *parent=nullptr)
 Constructs the command capturing old and new positions.
void redo () override
 Moves elements to their new positions.
void undo () override
 Restores elements to their old positions.

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 records a drag-move of a set of elements.

Definition at line 159 of file Commands.h.

Constructor & Destructor Documentation

◆ MoveCommand()

MoveCommand::MoveCommand ( const QList< GraphicElement * > & list,
const QList< QPointF > & oldPositions,
Scene * scene,
QUndoCommand * parent = nullptr )
explicit

Constructs the command capturing old and new positions.

Parameters
listElements that were moved.
oldPositionsPositions before the move.
sceneTarget scene.
parentOptional parent undo command.

Definition at line 392 of file Commands.cpp.

References ElementsCommand::ElementsCommand().

Member Function Documentation

◆ redo()

void MoveCommand::redo ( )
override

Moves elements to their new positions.

Definition at line 416 of file Commands.cpp.

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

◆ undo()

void MoveCommand::undo ( )
override

Restores elements to their old positions.

Definition at line 405 of file Commands.cpp.

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


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