QElectroTech 0.100.0-dev
Loading...
Searching...
No Matches
addgraphicsobjectcommand.h
Go to the documentation of this file.
1/*
2 Copyright 2006-2024 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 ADDGRAPHICSOBJECTCOMMAND_H
19#define ADDGRAPHICSOBJECTCOMMAND_H
20
21#include <QUndoCommand>
22#include <QPointF>
23#include <QPointer>
24
25class QGraphicsObject;
26class Diagram;
27
32class AddGraphicsObjectCommand : public QUndoCommand
33{
34 public:
35 AddGraphicsObjectCommand(QGraphicsObject *qgo, Diagram *diagram,
36 const QPointF &pos = QPointF(),
37 QUndoCommand *parent = nullptr);
39
40 void undo() override;
41 void redo() override;
42
43 private:
44 QString itemText() const;
45
46 private:
47 QPointer<QGraphicsObject> m_item;
48 Diagram *m_diagram = nullptr;
49 QPointF m_pos;
50};
51
52#endif // ADDGRAPHICSOBJECTCOMMAND_H
The AddGraphicsObjectCommand class Undo command to used to add item to a diagram.
Definition addgraphicsobjectcommand.h:33
QString itemText() const
AddGraphicsObjectCommand::itemText.
Definition addgraphicsobjectcommand.cpp:83
Diagram * m_diagram
Definition addgraphicsobjectcommand.h:48
~AddGraphicsObjectCommand() override
AddGraphicsObjectCommand::~AddGraphicsObjectCommand.
Definition addgraphicsobjectcommand.cpp:46
void redo() override
AddGraphicsObjectCommand::redo Reimplemented from QUndoCommand.
Definition addgraphicsobjectcommand.cpp:68
QPointer< QGraphicsObject > m_item
Definition addgraphicsobjectcommand.h:47
void undo() override
AddGraphicsObjectCommand::undo Reimplemented from QUndoCommand.
Definition addgraphicsobjectcommand.cpp:54
QPointF m_pos
Definition addgraphicsobjectcommand.h:49
The Diagram class This class represents an electric diagram. It manages its various child elements,...
Definition diagram.h:56