QElectroTech  0.70
conductortextitem.h
Go to the documentation of this file.
1 /*
2  Copyright 2006-2019 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
void hoverLeaveEvent(QGraphicsSceneHoverEvent *) override
virtual bool wasMovedByUser() const
void mousePressEvent(QGraphicsSceneMouseEvent *event) override
ConductorTextItem::mousePressEvent.
virtual void setPos(const QPointF &pos)
ConductorTextItem::setPos.
void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override
ConductorTextItem::mouseMoveEvent.
virtual void forceMovedByUser(bool)
~ConductorTextItem() override
void fromXml(const QDomElement &) override
ConductorTextItem::fromXml Read the properties stored in the xml element given in parameter...
virtual void forceRotateByUser(bool)
ConductorTextItem::forceRotateByUser.
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override
ConductorTextItem::mouseReleaseEvent.
ConductorTextItem(Conductor *=nullptr)
void hoverEnterEvent(QGraphicsSceneHoverEvent *) override
virtual bool wasRotateByUser() const
ConductorTextItem::wasRotateByUser.
void hoverMoveEvent(QGraphicsSceneHoverEvent *) override
Conductor * parentConductor() const
int type() const override
Conductor * parent_conductor_