QElectroTech 0.200.1-dev
Loading...
Searching...
No Matches
PromoteShapeCommand Class Reference

The PromoteShapeCommand class Used whenever a shape's identity changes – a Rectangle's corner is dragged independently and it becomes a Polygon, an Arc is explicitly converted to a free-form Path, etc. More...

#include <promoteshapecommand.h>

Inherits QUndoCommand.

Collaboration diagram for PromoteShapeCommand:
Collaboration graph

Public Member Functions

 PromoteShapeCommand (QetShapeItem *shape, const QDomElement &priorStateXml, const QDomElement &newStateXml, QUndoCommand *parent=nullptr)
void undo () override
void redo () override

Private Attributes

QPointer< QetShapeItemm_shape
QDomDocument m_priorDoc
QDomDocument m_newDoc

Detailed Description

The PromoteShapeCommand class Used whenever a shape's identity changes – a Rectangle's corner is dragged independently and it becomes a Polygon, an Arc is explicitly converted to a free-form Path, etc.

The saved .qet file never records what a shape used to be; that fact only needs to survive as long as the rest of the edit history does, so it lives entirely here, as a full XML snapshot on each side. Undo restores the exact prior shape – type, geometry and transform alike – by round-tripping through the same fromXml() every other load uses. Once the file is saved and reopened, the promotion is permanent, same as any other undo history.

Constructor & Destructor Documentation

◆ PromoteShapeCommand()

PromoteShapeCommand::PromoteShapeCommand ( QetShapeItem * shape,
const QDomElement & priorStateXml,
const QDomElement & newStateXml,
QUndoCommand * parent = nullptr )

Member Function Documentation

◆ redo()

void PromoteShapeCommand::redo ( )
override

◆ undo()

void PromoteShapeCommand::undo ( )
override

Member Data Documentation

◆ m_newDoc

QDomDocument PromoteShapeCommand::m_newDoc
private

◆ m_priorDoc

QDomDocument PromoteShapeCommand::m_priorDoc
private

◆ m_shape

QPointer<QetShapeItem> PromoteShapeCommand::m_shape
private

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