QElectroTech 0.200.1-dev
Loading...
Searching...
No Matches
rotateselectioncommand.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 ROTATESELECTIONCOMMAND_H
19#define ROTATESELECTIONCOMMAND_H
20
21#include <QUndoCommand>
22#include <QPointer>
23#include <QHash>
24#include <QPointF>
25
26class Diagram;
29class QGraphicsItem;
30
35class RotateSelectionCommand : public QUndoCommand
36{
37 public:
38 RotateSelectionCommand(Diagram *diagram, qreal angle=90, QUndoCommand *parent=nullptr, bool rotate_as_group=false);
39 void undo() override;
40 void redo() override;
41
42 bool isValid();
43
44 private:
45 void addGroupPositionUndo(QGraphicsItem *item, const QPointF &pivot, qreal angle);
46
47 Diagram *m_diagram =nullptr;
48
49 QList<QPointer<ConductorTextItem>> m_cond_text;
50 QHash<ConductorTextItem *, bool> m_rotate_by_user;
51 QList<QPropertyUndoCommand*> m_undo;
52
53};
54
55#endif // ROTATESELECTIONCOMMAND_H
Definition conductortextitem.h:30
The Diagram class This class represents an electric diagram. It manages its various child elements,...
Definition diagram.h:54
The QPropertyUndoCommand class This undo command manage QProperty of a QObject. This undo command can...
Definition qpropertyundocommand.h:34
void addGroupPositionUndo(QGraphicsItem *item, const QPointF &pivot, qreal angle)
RotateSelectionCommand::addGroupPositionUndo Queue a "pos" QPropertyUndoCommand that rotates item's p...
Definition rotateselectioncommand.cpp:139
void undo() override
RotateSelectionCommand::undo.
Definition rotateselectioncommand.cpp:210
void redo() override
RotateSelectionCommand::redo.
Definition rotateselectioncommand.cpp:226
QHash< ConductorTextItem *, bool > m_rotate_by_user
Definition rotateselectioncommand.h:50
QList< QPropertyUndoCommand * > m_undo
Definition rotateselectioncommand.h:51
bool isValid()
RotateSelectionCommand::isValid.
Definition rotateselectioncommand.cpp:242
QList< QPointer< ConductorTextItem > > m_cond_text
Definition rotateselectioncommand.h:49
Diagram * m_diagram
Definition rotateselectioncommand.h:47
RotateSelectionCommand(Diagram *diagram, qreal angle=90, QUndoCommand *parent=nullptr, bool rotate_as_group=false)
Definition rotateselectioncommand.cpp:34