The AddDiagramCommand class Undo/redo support for adding a new folio (diagram) to a project. Takes ownership of the (already constructed, not yet inserted) diagram: redo() inserts it into the project, undo() detaches it again without destroying it. The diagram is only actually destroyed when this command itself is destroyed while the diagram is detached (i.e. while undone).
More...
#include <adddiagramcommand.h>
Inherits QUndoCommand.
The AddDiagramCommand class Undo/redo support for adding a new folio (diagram) to a project. Takes ownership of the (already constructed, not yet inserted) diagram: redo() inserts it into the project, undo() detaches it again without destroying it. The diagram is only actually destroyed when this command itself is destroyed while the diagram is detached (i.e. while undone).
◆ AddDiagramCommand()
| AddDiagramCommand::AddDiagramCommand |
( |
QETProject * | project, |
|
|
Diagram * | diagram, |
|
|
int | pos = -1, |
|
|
QUndoCommand * | parent = nullptr ) |
AddDiagramCommand::AddDiagramCommand.
- Parameters
-
| project | : project the diagram is added to |
| diagram | : the already constructed diagram to add (not yet part of any project's diagram list) |
| pos | : position to insert the diagram at, -1 to append at the end |
| parent | |
◆ ~AddDiagramCommand()
| AddDiagramCommand::~AddDiagramCommand |
( |
| ) |
|
|
override |
AddDiagramCommand::~AddDiagramCommand Destroy the diagram only if it is currently detached from the project (i.e. this add was undone) – otherwise the project owns it and will destroy it itself.
◆ redo()
| void AddDiagramCommand::redo |
( |
| ) |
|
|
override |
◆ undo()
| void AddDiagramCommand::undo |
( |
| ) |
|
|
override |
◆ m_diagram
| Diagram* AddDiagramCommand::m_diagram |
|
private |
◆ m_owns_diagram
| bool AddDiagramCommand::m_owns_diagram = true |
|
private |
true while the diagram is detached from the project (not currently in its diagram list)
◆ m_position
| int AddDiagramCommand::m_position |
|
private |
◆ m_project
The documentation for this class was generated from the following files: