QElectroTech  0.8-dev
elementtextsmover.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 ELEMENT_TEXTS_MOVER_H
19 #define ELEMENT_TEXTS_MOVER_H
20 
21 #include <QSet>
22 #include <QPointF>
23 
24 class QGraphicsItem;
25 class DiagramTextItem;
26 class Diagram;
27 class QGraphicsItemGroup;
28 class QGraphicsSceneMouseEvent;
29 
35 {
36  public:
38  private:
40 
41  public:
42  bool isReady() const;
43  int beginMovement(Diagram *diagram, QGraphicsItem *driver_item = nullptr);
44  void continueMovement(QGraphicsSceneMouseEvent *event);
45  void endMovement();
46 
47  private:
48  QString undoText() const;
49 
50  private:
51  bool m_movement_running = false;
52  Diagram *m_diagram = nullptr;
53  QGraphicsItem *m_movement_driver = nullptr;
54  QHash <DiagramTextItem *, QPointF> m_texts_hash;
55  QHash <QGraphicsItemGroup *, QPointF> m_grps_hash;
56  QHash <QGraphicsItem *, QPointF> m_items_hash;
57  int m_text_count = 0,
59 };
60 #endif
QPropertyUndoCommand::enableAnimation
void enableAnimation(bool animate=true)
QPropertyUndoCommand::enableAnimation True to enable animation.
Definition: qpropertyundocommand.cpp:92
ElementTextsMover::continueMovement
void continueMovement(QGraphicsSceneMouseEvent *event)
Definition: elementtextsmover.cpp:82
ElementTextsMover::m_items_hash
QHash< QGraphicsItem *, QPointF > m_items_hash
Definition: elementtextsmover.h:56
ElementTextsMover::m_grps_hash
QHash< QGraphicsItemGroup *, QPointF > m_grps_hash
Definition: elementtextsmover.h:55
ElementTextsMover::m_movement_driver
QGraphicsItem * m_movement_driver
Definition: elementtextsmover.h:53
ElementTextsMover::m_diagram
Diagram * m_diagram
Definition: elementtextsmover.h:52
elementtextitemgroup.h
ElementTextsMover::m_group_count
int m_group_count
Definition: elementtextsmover.h:58
Diagram
The Diagram class This class represents an electric diagram. It manages its various child elements,...
Definition: diagram.h:56
DynamicElementTextItem::Type
@ Type
Definition: dynamicelementtextitem.h:61
ElementTextsMover::beginMovement
int beginMovement(Diagram *diagram, QGraphicsItem *driver_item=nullptr)
ElementTextsMover::beginMovement Begin a movement.
Definition: elementtextsmover.cpp:46
ElementTextsMover::ElementTextsMover
ElementTextsMover(const ElementTextsMover &)
ElementTextsMover::endMovement
void endMovement()
ElementTextsMover::endMovement Finish the movement by pushing an undo command to the parent diagram o...
Definition: elementtextsmover.cpp:107
ElementTextsMover::m_texts_hash
QHash< DiagramTextItem *, QPointF > m_texts_hash
Definition: elementtextsmover.h:54
elementtextsmover.h
ElementTextsMover::m_movement_running
bool m_movement_running
Definition: elementtextsmover.h:51
ElementTextsMover::m_text_count
int m_text_count
Definition: elementtextsmover.h:57
ElementTextsMover
Definition: elementtextsmover.h:35
qpropertyundocommand.h
ElementTextsMover::isReady
bool isReady() const
ElementTextsMover::isReady.
Definition: elementtextsmover.cpp:35
Diagram::undoStack
QUndoStack & undoStack()
Diagram::undoStack.
Definition: diagram.h:397
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
ElementTextsMover::ElementTextsMover
ElementTextsMover()
ElementTextsMover::ElementTextsMover.
Definition: elementtextsmover.cpp:28
Diagram::snapToGrid
static QPointF snapToGrid(const QPointF &p)
Diagram::snapToGrid Return a nearest snap point of p.
Definition: diagram.cpp:2240
dynamicelementtextitem.h
QPropertyUndoCommand
The QPropertyUndoCommand class This undo command manage QProperty of a QObject. This undo command can...
Definition: qpropertyundocommand.h:34
QET::Icons::tr
QIcon tr
Definition: qeticons.cpp:206
ElementTextsMover::undoText
QString undoText() const
Definition: elementtextsmover.cpp:134
diagram.h