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

Undo command that flips a selection of elements along a horizontal or vertical axis. More...

#include <Commands.h>

Inheritance diagram for FlipCommand:
[legend]

Public Member Functions

 FlipCommand (const QList< GraphicElement * > &items, const int axis, Scene *scene, QUndoCommand *parent=nullptr)
 Constructs the flip command.
void redo () override
 Applies the flip transformation.
void undo () override
 Reverses the flip transformation (involution: flip twice = identity).

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 flips a selection of elements along a horizontal or vertical axis.

Definition at line 384 of file Commands.h.

Constructor & Destructor Documentation

◆ FlipCommand()

FlipCommand::FlipCommand ( const QList< GraphicElement * > & items,
const int axis,
Scene * scene,
QUndoCommand * parent = nullptr )
explicit

Constructs the flip command.

Parameters
itemsElements to flip.
axis0 = horizontal flip (mirror left-right), 1 = vertical flip (mirror top-bottom).
sceneTarget scene.
parentOptional parent undo command.

Definition at line 897 of file Commands.cpp.

References ElementsCommand::ElementsCommand().

Member Function Documentation

◆ redo()

void FlipCommand::redo ( )
override

Applies the flip transformation.

Definition at line 935 of file Commands.cpp.

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

Referenced by undo().

◆ undo()

void FlipCommand::undo ( )
override

Reverses the flip transformation (involution: flip twice = identity).

Definition at line 927 of file Commands.cpp.

References qCDebug, and redo().


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