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

Undo command for property changes (label, color, frequency, appearance, etc.). More...

#include <Commands.h>

Inheritance diagram for UpdateCommand:
[legend]

Public Member Functions

void redo () override
 Applies the new property values.
void undo () override
 Restores the old property values.
 UpdateCommand (const QList< GraphicElement * > &elements, const QByteArray &oldData, Scene *scene, QUndoCommand *parent=nullptr)
 Constructs the command.

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 for property changes (label, color, frequency, appearance, etc.).

Captures the pre-change state in oldData; the post-change state is serialized from the elements at construction time.

Definition at line 192 of file Commands.h.

Constructor & Destructor Documentation

◆ UpdateCommand()

UpdateCommand::UpdateCommand ( const QList< GraphicElement * > & elements,
const QByteArray & oldData,
Scene * scene,
QUndoCommand * parent = nullptr )
explicit

Constructs the command.

Parameters
elementsElements whose properties changed.
oldDataSerialized state before the change.
sceneTarget scene.
parentOptional parent undo command.

Definition at line 427 of file Commands.cpp.

References ElementsCommand::elements(), ElementsCommand::ElementsCommand(), InMemorySnapshot, ElementsCommand::m_scene, and Serialization::writePandaHeader().

Member Function Documentation

◆ redo()

void UpdateCommand::redo ( )
override

Applies the new property values.

Definition at line 471 of file Commands.cpp.

References ElementsCommand::m_scene, and qCDebug.

◆ undo()

void UpdateCommand::undo ( )
override

Restores the old property values.

Definition at line 460 of file Commands.cpp.

References ElementsCommand::m_scene, and qCDebug.


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