QElectroTech 0.200.1-dev
Loading...
Searching...
No Matches
adddiagramcommand.h
Go to the documentation of this file.
1/*
2 Copyright 2006-2026 The QElectroTech Team
3 This file is part of QElectroTech.
4
5 QElectroTech is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 2 of the License, or
8 (at your option) any later version.
9
10 QElectroTech is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
17*/
18#ifndef ADDDIAGRAMCOMMAND_H
19#define ADDDIAGRAMCOMMAND_H
20
21#include <QUndoCommand>
22#include <QPointer>
23
24class QETProject;
25class Diagram;
26
35class AddDiagramCommand : public QUndoCommand
36{
37 public:
38 AddDiagramCommand(QETProject *project, Diagram *diagram, int pos = -1, QUndoCommand *parent = nullptr);
39 ~AddDiagramCommand() override;
40
41 void undo() override;
42 void redo() override;
43
44 private:
45 QPointer<QETProject> m_project;
49 bool m_owns_diagram = true;
50};
51
52#endif // ADDDIAGRAMCOMMAND_H
bool m_owns_diagram
true while the diagram is detached from the project (not currently in its diagram list)
Definition adddiagramcommand.h:49
~AddDiagramCommand() override
AddDiagramCommand::~AddDiagramCommand Destroy the diagram only if it is currently detached from the p...
Definition adddiagramcommand.cpp:45
int m_position
Definition adddiagramcommand.h:47
QPointer< QETProject > m_project
Definition adddiagramcommand.h:45
Diagram * m_diagram
Definition adddiagramcommand.h:46
void redo() override
Definition adddiagramcommand.cpp:52
void undo() override
Definition adddiagramcommand.cpp:61
AddDiagramCommand(QETProject *project, Diagram *diagram, int pos=-1, QUndoCommand *parent=nullptr)
AddDiagramCommand::AddDiagramCommand.
Definition adddiagramcommand.cpp:30
The Diagram class This class represents an electric diagram. It manages its various child elements,...
Definition diagram.h:54
Definition qetproject.h:77