QElectroTech 0.200.1-dev
Loading...
Searching...
No Matches
promoteshapecommand.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 PROMOTESHAPECOMMAND_H
19#define PROMOTESHAPECOMMAND_H
20
21#include <QUndoCommand>
22#include <QPointer>
23#include <QDomElement>
24
25class QetShapeItem;
26
41class PromoteShapeCommand : public QUndoCommand
42{
43 public:
45 QetShapeItem *shape,
46 const QDomElement &priorStateXml,
47 const QDomElement &newStateXml,
48 QUndoCommand *parent = nullptr);
49
50 void undo() override;
51 void redo() override;
52
53 private:
54 QPointer<QetShapeItem> m_shape;
55 // Deep-cloned into private documents at construction time: a
56 // QDomElement is only a reference into whatever QDomDocument it
57 // came from, and that document (typically a short-lived one built
58 // just to call toXml()) is not guaranteed to outlive this command.
59 QDomDocument m_priorDoc, m_newDoc;
60};
61
62#endif // PROMOTESHAPECOMMAND_H
PromoteShapeCommand(QetShapeItem *shape, const QDomElement &priorStateXml, const QDomElement &newStateXml, QUndoCommand *parent=nullptr)
Definition promoteshapecommand.cpp:21
QPointer< QetShapeItem > m_shape
Definition promoteshapecommand.h:54
void undo() override
Definition promoteshapecommand.cpp:33
QDomDocument m_newDoc
Definition promoteshapecommand.h:59
void redo() override
Definition promoteshapecommand.cpp:39
QDomDocument m_priorDoc
Definition promoteshapecommand.h:59
The QetShapeItem class this class is used to draw a basic shape (line, rectangle, ellipse,...
Definition qetshapeitem.h:42