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

The RemoveDiagramCommand class Undo/redo support for removing a folio (diagram) from a project. redo() detaches the diagram from the project (and, reactively, its ProjectView tab) without destroying it; undo() reinserts it at its original position. The diagram is only actually destroyed when this command itself is destroyed while the diagram is detached (i.e. while the removal is still in effect). More...

#include <removediagramcommand.h>

Inherits QUndoCommand.

Collaboration diagram for RemoveDiagramCommand:
Collaboration graph

Public Member Functions

 RemoveDiagramCommand (QETProject *project, Diagram *diagram, QUndoCommand *parent=nullptr)
 RemoveDiagramCommand::RemoveDiagramCommand.
 ~RemoveDiagramCommand () override
 RemoveDiagramCommand::~RemoveDiagramCommand Destroy the diagram only if it is currently detached from the project (i.e. the removal is currently in effect) – otherwise the project owns it and will destroy it itself.
void undo () override
void redo () override

Private Attributes

QPointer< QETProjectm_project
Diagramm_diagram
int m_position
bool m_owns_diagram = false
 true while the diagram is detached from the project (i.e. the removal is in effect)

Detailed Description

The RemoveDiagramCommand class Undo/redo support for removing a folio (diagram) from a project. redo() detaches the diagram from the project (and, reactively, its ProjectView tab) without destroying it; undo() reinserts it at its original position. The diagram is only actually destroyed when this command itself is destroyed while the diagram is detached (i.e. while the removal is still in effect).

Constructor & Destructor Documentation

◆ RemoveDiagramCommand()

RemoveDiagramCommand::RemoveDiagramCommand ( QETProject * project,
Diagram * diagram,
QUndoCommand * parent = nullptr )

RemoveDiagramCommand::RemoveDiagramCommand.

Parameters
project: project the diagram is removed from
diagram: the diagram to remove, currently part of project
parent

◆ ~RemoveDiagramCommand()

RemoveDiagramCommand::~RemoveDiagramCommand ( )
override

RemoveDiagramCommand::~RemoveDiagramCommand Destroy the diagram only if it is currently detached from the project (i.e. the removal is currently in effect) – otherwise the project owns it and will destroy it itself.

Member Function Documentation

◆ redo()

void RemoveDiagramCommand::redo ( )
override

◆ undo()

void RemoveDiagramCommand::undo ( )
override

Member Data Documentation

◆ m_diagram

Diagram* RemoveDiagramCommand::m_diagram
private

◆ m_owns_diagram

bool RemoveDiagramCommand::m_owns_diagram = false
private

true while the diagram is detached from the project (i.e. the removal is in effect)

◆ m_position

int RemoveDiagramCommand::m_position
private

◆ m_project

QPointer<QETProject> RemoveDiagramCommand::m_project
private

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