QElectroTech  0.8-dev
rotatetextscommand.h
Go to the documentation of this file.
1 /*
2  Copyright 2006-2020 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 ROTATETEXTSCOMMAND_H
19 #define ROTATETEXTSCOMMAND_H
20 
21 #include <QUndoCommand>
22 #include <QPointer>
23 
24 class ConductorTextItem;
25 class Diagram;
26 class QParallelAnimationGroup;
27 
33 class RotateTextsCommand : public QUndoCommand
34 {
35  public:
36  RotateTextsCommand(Diagram *diagram, QUndoCommand *parent=nullptr);
37 
38  void undo() override;
39  void redo() override;
40 
41  private:
42  void openDialog();
43  void setupAnimation(QObject *target, const QByteArray &propertyName, const QVariant& start, const QVariant& end);
44 
45  private:
46  QPointer<Diagram> m_diagram;
47  QHash<ConductorTextItem *, bool> m_cond_texts;
48  qreal m_rotation=0;
49  QParallelAnimationGroup *m_anim_group = nullptr;
50 };
51 
52 #endif // ROTATETEXTSCOMMAND_H
RotateTextsCommand::undo
void undo() override
Definition: rotatetextscommand.cpp:82
RotateTextsCommand::redo
void redo() override
Definition: rotatetextscommand.cpp:94
RotateTextsCommand::openDialog
void openDialog()
Definition: rotatetextscommand.cpp:106
RotateTextsCommand::setupAnimation
void setupAnimation(QObject *target, const QByteArray &propertyName, const QVariant &start, const QVariant &end)
Definition: rotatetextscommand.cpp:137
RotateTextsCommand::m_diagram
QPointer< Diagram > m_diagram
Definition: rotatetextscommand.h:46
QTextOrientationSpinBoxWidget::orientation
double orientation() const
Definition: qtextorientationspinboxwidget.cpp:53
QETApp::createTextOrientationSpinBoxWidget
static QTextOrientationSpinBoxWidget * createTextOrientationSpinBoxWidget()
QETApp::createTextOrientationSpinBoxWidget Instantiates a QTextOrientationSpinBoxWidget and configure...
Definition: qetapp.cpp:1272
conductortextitem.h
elementtextitemgroup.h
QTextOrientationSpinBoxWidget::spinBox
QDoubleSpinBox * spinBox() const
Definition: qtextorientationspinboxwidget.cpp:46
DiagramContent
Definition: diagramcontent.h:46
qetapp.h
RotateTextsCommand::m_cond_texts
QHash< ConductorTextItem *, bool > m_cond_texts
Definition: rotatetextscommand.h:47
rotatetextscommand.h
qtextorientationspinboxwidget.h
Diagram
The Diagram class This class represents an electric diagram. It manages its various child elements,...
Definition: diagram.h:56
DiagramContent::selectedTextsGroup
QList< ElementTextItemGroup * > selectedTextsGroup() const
DiagramContent::selectedTextsGroup.
Definition: diagramcontent.cpp:150
QTextOrientationSpinBoxWidget
Definition: qtextorientationspinboxwidget.h:27
RotateTextsCommand::RotateTextsCommand
RotateTextsCommand(Diagram *diagram, QUndoCommand *parent=nullptr)
RotateTextsCommand::RotateTextsCommand.
Definition: rotatetextscommand.cpp:33
RotateTextsCommand::m_rotation
qreal m_rotation
Definition: rotatetextscommand.h:48
diagramcontent.h
DiagramTextItem
Definition: diagramtextitem.h:34
ElementTextItemGroup
The ElementTextItemGroup class This class represent a group of element text Texts in the group can be...
Definition: elementtextitemgroup.h:36
diagramtextitem.h
DiagramContent::selectedTexts
QList< DiagramTextItem * > selectedTexts() const
DiagramContent::selectedTexts.
Definition: diagramcontent.cpp:130
RotateTextsCommand::m_anim_group
QParallelAnimationGroup * m_anim_group
Definition: rotatetextscommand.h:49
ConductorTextItem::Type
@ Type
Definition: conductortextitem.h:42
ConductorTextItem
Definition: conductortextitem.h:30
RotateTextsCommand
The RotateTextsCommand class Open a dialog for edit the rotation of the current selected texts and te...
Definition: rotatetextscommand.h:34
ConductorTextItem::wasRotateByUser
virtual bool wasRotateByUser() const
ConductorTextItem::wasRotateByUser.
Definition: conductortextitem.cpp:92
QET::Icons::tr
QIcon tr
Definition: qeticons.cpp:206
QET::Icons::Cancel
QIcon Cancel
Definition: qeticons.cpp:34
diagram.h