QElectroTech  0.70
elementtextsmover.h
Go to the documentation of this file.
1 /*
2  Copyright 2006-2012 Xavier Guerrin
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
int beginMovement(Diagram *diagram, QGraphicsItem *driver_item=nullptr)
ElementTextsMover::beginMovement Begin a movement.
QHash< DiagramTextItem *, QPointF > m_texts_hash
QString undoText() const
QHash< QGraphicsItem *, QPointF > m_items_hash
QHash< QGraphicsItemGroup *, QPointF > m_grps_hash
void continueMovement(QGraphicsSceneMouseEvent *event)
QGraphicsItem * m_movement_driver
ElementTextsMover()
ElementTextsMover::ElementTextsMover.
bool isReady() const
ElementTextsMover::isReady.
void endMovement()
ElementTextsMover::endMovement Finish the movement by pushing an undo command to the parent diagram o...