QElectroTech  0.8-dev
conductortextitem.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 CONDUCTOR_TEXT_ITEM_H
19 #define CONDUCTOR_TEXT_ITEM_H
20 #include "diagramtextitem.h"
21 class Conductor;
30 {
31  Q_OBJECT
32 
33  // constructors, destructor
34  public:
35  ConductorTextItem(Conductor * = nullptr);
36  ConductorTextItem(const QString &, Conductor * = nullptr);
37  ~ConductorTextItem() override;
38  private:
40 
41  public:
42  enum { Type = UserType + 1006 };
43  Conductor *parentConductor() const;
44  void fromXml(const QDomElement &) override;
45  int type() const override { return Type; }
46  virtual bool wasMovedByUser() const;
47  virtual bool wasRotateByUser() const;
48  virtual void forceMovedByUser(bool);
49  virtual void forceRotateByUser(bool);
50  virtual void setPos(const QPointF &pos);
51  virtual void setPos(qreal x, qreal y);
52 
53  protected:
54  void mousePressEvent (QGraphicsSceneMouseEvent *event) override;
55  void mouseMoveEvent (QGraphicsSceneMouseEvent *event) override;
56  void mouseReleaseEvent (QGraphicsSceneMouseEvent *event) override;
57  void hoverEnterEvent(QGraphicsSceneHoverEvent *) override;
58  void hoverLeaveEvent(QGraphicsSceneHoverEvent *) override;
59  void hoverMoveEvent(QGraphicsSceneHoverEvent *) override;
60 
61  // attributes
62  private:
66  QPointF before_mov_pos_;
67 };
68 #endif
ConductorTextItem::before_mov_pos_
QPointF before_mov_pos_
Definition: conductortextitem.h:66
ConductorTextItem::wasMovedByUser
virtual bool wasMovedByUser() const
Definition: conductortextitem.cpp:84
Conductor::nearShape
virtual QPainterPath nearShape() const
Conductor::nearShape.
Definition: conductor.cpp:904
ConductorTextItem::ConductorTextItem
ConductorTextItem(Conductor *=nullptr)
Definition: conductortextitem.cpp:27
DiagramTextItem::mousePressEvent
void mousePressEvent(QGraphicsSceneMouseEvent *event) override
DiagramTextItem::mousePressEvent.
Definition: diagramtextitem.cpp:319
diagramcommands.h
ConductorTextItem::forceRotateByUser
virtual void forceRotateByUser(bool)
ConductorTextItem::forceRotateByUser.
Definition: conductortextitem.cpp:117
DiagramTextItem::m_mouse_hover
bool m_mouse_hover
Definition: diagramtextitem.h:110
ConductorTextItem::~ConductorTextItem
~ConductorTextItem() override
Definition: conductortextitem.cpp:52
ConductorTextItem::setPos
virtual void setPos(const QPointF &pos)
ConductorTextItem::setPos.
Definition: conductortextitem.cpp:130
DiagramTextItem::diagram
Diagram * diagram() const
DiagramTextItem::diagram.
Definition: diagramtextitem.cpp:63
ConductorTextItem::moved_by_user_
bool moved_by_user_
Definition: conductortextitem.h:64
ConductorTextItem::parentConductor
Conductor * parentConductor() const
Definition: conductortextitem.cpp:59
conductor.h
DiagramTextItem::m_mouse_to_origin_movement
QPointF m_mouse_to_origin_movement
Definition: diagramtextitem.h:119
Conductor::boundingRect
QRectF boundingRect() const override
Conductor::boundingRect.
Definition: conductor.cpp:878
conductortextitem.h
ConductorTextItem::mouseReleaseEvent
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override
ConductorTextItem::mouseReleaseEvent.
Definition: conductortextitem.cpp:199
Conductor::Alert
@ Alert
Definition: conductor.h:65
ConductorTextItem::mouseMoveEvent
void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override
ConductorTextItem::mouseMoveEvent.
Definition: conductortextitem.cpp:174
ConductorTextItem::fromXml
void fromXml(const QDomElement &) override
ConductorTextItem::fromXml Read the properties stored in the xml element given in parameter.
Definition: conductortextitem.cpp:68
Diagram
The Diagram class This class represents an electric diagram. It manages its various child elements,...
Definition: diagram.h:56
MoveConductorsTextsCommand
The MoveConductorsTextsCommand class This command moves text items related to conductors on a particu...
Definition: diagramcommands.h:172
ConductorTextItem::type
int type() const override
Definition: conductortextitem.h:45
ConductorTextItem::hoverLeaveEvent
void hoverLeaveEvent(QGraphicsSceneHoverEvent *) override
Definition: conductortextitem.cpp:246
DiagramTextItem
Definition: diagramtextitem.h:34
ConductorTextItem::hoverMoveEvent
void hoverMoveEvent(QGraphicsSceneHoverEvent *) override
Definition: conductortextitem.cpp:257
ConductorTextItem::hoverEnterEvent
void hoverEnterEvent(QGraphicsSceneHoverEvent *) override
Definition: conductortextitem.cpp:232
diagramtextitem.h
Diagram::snapToGrid
static QPointF snapToGrid(const QPointF &p)
Diagram::snapToGrid Return a nearest snap point of p.
Definition: diagram.cpp:2240
Conductor::None
@ None
Definition: conductor.h:65
ConductorTextItem::forceMovedByUser
virtual void forceMovedByUser(bool)
Definition: conductortextitem.cpp:101
ConductorTextItem::rotate_by_user_
bool rotate_by_user_
Definition: conductortextitem.h:65
ConductorTextItem::Type
@ Type
Definition: conductortextitem.h:42
ConductorTextItem::parent_conductor_
Conductor * parent_conductor_
Definition: conductortextitem.h:63
Conductor
Definition: conductor.h:43
ConductorTextItem
Definition: conductortextitem.h:30
ConductorTextItem::wasRotateByUser
virtual bool wasRotateByUser() const
ConductorTextItem::wasRotateByUser.
Definition: conductortextitem.cpp:92
ConductorTextItem::ConductorTextItem
ConductorTextItem(const ConductorTextItem &)
ConductorTextItem::mousePressEvent
void mousePressEvent(QGraphicsSceneMouseEvent *event) override
ConductorTextItem::mousePressEvent.
Definition: conductortextitem.cpp:165
diagram.h
Conductor::Normal
@ Normal
Definition: conductor.h:65