QElectroTech  0.8-dev
partterminal.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 PART_TERMINAL_H
19 #define PART_TERMINAL_H
20 
22 #include "QUuid"
23 #include "terminaldata.h"
24 
25 
31  Q_OBJECT
33  Q_PROPERTY(QString name READ name WRITE setName)
34 
35  public:
36  // constructors, destructor
37  PartTerminal(QETElementEditor *editor, QGraphicsItem *parent = nullptr);
38  ~PartTerminal() override;
39  private:
41 
42  signals:
44  void nameChanged();
45 
46  // methods
47  public:
48  enum { Type = UserType + 1106 };
53  int type() const override { return Type; }
54  QString name() const override { return d -> m_name; }
55  QString xmlName() const override { return(QString("terminal")); }
56  void fromXml(const QDomElement &) override;
57  const QDomElement toXml(QDomDocument &) const override;
58  void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *) override;
59 
60  QPainterPath shape() const override;
61  QPainterPath shadowShape() const override {return shape();}
62  QRectF boundingRect() const override;
63  bool isUseless() const override;
64  QRectF sceneGeometricRect() const override;
65  void startUserTransformation(const QRectF &) override;
66  void handleUserTransformation(const QRectF &, const QRectF &) override;
67 
68  Qet::Orientation orientation() const {return d -> m_orientation;}
70 
71  void setName(QString& name);
72  void setNewUuid();
73 
74  private:
75  void updateSecondPoint();
76  TerminalData* d; // pointer to the terminal data
77 
78  private:
79  QPointF saved_position_;
80 };
81 #endif
PartTerminal::isUseless
bool isUseless() const override
Definition: partterminal.cpp:168
PartTerminal::type
int type() const override
Definition: partterminal.h:53
PartTerminal::orientationChanged
void orientationChanged()
Qet::West
@ West
Definition: qet.h:209
PartTerminal::d
TerminalData * d
Definition: partterminal.h:76
CustomElementGraphicPart
The CustomElementGraphicPart class This class is the base for all home-made primitive like line,...
Definition: customelementgraphicpart.h:36
PartTerminal::PartTerminal
PartTerminal(QETElementEditor *editor, QGraphicsItem *parent=nullptr)
PartTerminal::PartTerminal.
Definition: partterminal.cpp:28
PartTerminal::~PartTerminal
~PartTerminal() override
Destructeur.
Definition: partterminal.cpp:39
PartTerminal::name
QString name() const override
Definition: partterminal.h:54
PartTerminal::saved_position_
QPointF saved_position_
Definition: partterminal.h:79
PartTerminal::name
QString name
Definition: partterminal.h:33
PartTerminal::xmlName
QString xmlName() const override
Definition: partterminal.h:55
Terminal::neutralColor
static QColor neutralColor
default color
Definition: terminal.h:112
PartTerminal::setOrientation
void setOrientation(Qet::Orientation ori)
Definition: partterminal.cpp:127
PartTerminal::handleUserTransformation
void handleUserTransformation(const QRectF &, const QRectF &) override
Definition: partterminal.cpp:194
PartTerminal::toXml
const QDomElement toXml(QDomDocument &) const override
Definition: partterminal.cpp:57
PartTerminal::nameChanged
void nameChanged()
partterminal.h
PartTerminal::sceneGeometricRect
QRectF sceneGeometricRect() const override
Definition: partterminal.cpp:178
PartTerminal
Definition: partterminal.h:30
TerminalData
The TerminalData class Data of the terminal. Stored in extra class so it can be used by PartTerminal ...
Definition: terminaldata.h:20
Qet::Orientation
Orientation
Orientation (used for electrical elements and their terminals)
Definition: qet.h:206
PartTerminal::boundingRect
QRectF boundingRect() const override
PartTerminal::boundingRect.
Definition: partterminal.cpp:114
PartTerminal::orientation
Qet::Orientation orientation
Definition: partterminal.h:32
CustomElementGraphicPart::m_hovered
bool m_hovered
Definition: customelementgraphicpart.h:323
terminaldata.h
Qet::North
@ North
Definition: qet.h:206
PartTerminal::setNewUuid
void setNewUuid()
Definition: partterminal.cpp:144
PartTerminal::updateSecondPoint
void updateSecondPoint()
Definition: partterminal.cpp:152
customelementgraphicpart.h
PartTerminal::Type
@ Type
Definition: partterminal.h:48
PartTerminal::paint
void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *) override
Definition: partterminal.cpp:67
SHADOWS_HEIGHT
#define SHADOWS_HEIGHT
Definition: customelementgraphicpart.h:37
Qet::South
@ South
Definition: qet.h:208
PartTerminal::PartTerminal
PartTerminal(const PartTerminal &)
CustomElementPart::mapPoints
QList< QPointF > mapPoints(const QRectF &, const QRectF &, const QList< QPointF > &)
Definition: customelementpart.cpp:69
PartTerminal::shape
QPainterPath shape() const override
PartTerminal::shape.
Definition: partterminal.cpp:100
PartTerminal::startUserTransformation
void startUserTransformation(const QRectF &) override
Definition: partterminal.cpp:186
PartTerminal::orientation
Qet::Orientation orientation() const
Definition: partterminal.h:68
PartTerminal::setName
void setName(QString &name)
PartTerminal::setName.
Definition: partterminal.cpp:138
Qet::East
@ East
Definition: qet.h:207
terminal.h
PartTerminal::shadowShape
QPainterPath shadowShape() const override
Definition: partterminal.h:61
QET::Icons::br
QIcon br
Definition: qeticons.cpp:185
PartTerminal::fromXml
void fromXml(const QDomElement &) override
Definition: partterminal.cpp:46
QETElementEditor
Definition: qetelementeditor.h:33
CustomElementGraphicPart::drawShadowShape
void drawShadowShape(QPainter *painter)
CustomElementGraphicPart::drawShadowShape Draw a transparent blue shadow arround the shape of this it...
Definition: customelementgraphicpart.cpp:1240