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

Undo command that changes the number of input or output ports on selected elements. More...

#include <Commands.h>

Inheritance diagram for ChangePortSizeCommand:
[legend]

Public Member Functions

 ChangePortSizeCommand (const QList< GraphicElement * > &elements, const int newPortSize, Scene *scene, const bool isInput, QUndoCommand *parent=nullptr)
 Constructs the command.
void redo () override
 Applies the new port count.
void undo () override
 Restores the old port count and connections.

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 number of input or output ports on selected elements.

Definition at line 351 of file Commands.h.

Constructor & Destructor Documentation

◆ ChangePortSizeCommand()

ChangePortSizeCommand::ChangePortSizeCommand ( const QList< GraphicElement * > & elements,
const int newPortSize,
Scene * scene,
const bool isInput,
QUndoCommand * parent = nullptr )
explicit

Constructs the command.

Parameters
elementsElements whose port count will change.
newPortSizeDesired number of ports.
sceneTarget scene.
isInputIf true, adjusts input ports; otherwise adjusts output ports.
parentOptional parent undo command.

Definition at line 959 of file Commands.cpp.

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

Member Function Documentation

◆ redo()

◆ undo()

void ChangePortSizeCommand::undo ( )
override

Restores the old port count and connections.

Definition at line 1020 of file Commands.cpp.

References ElementsCommand::elements(), CommandUtils::findElements(), InMemorySnapshot, ElementsCommand::m_scene, and Serialization::readPandaHeader().


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