QElectroTech 0.100.0-dev
Loading...
Searching...
No Matches
partterminal.h
Go to the documentation of this file.
1/*
2 Copyright 2006-2024 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
21#include "../../properties/terminaldata.h"
23
24#include <QUuid>
25
31{
32 Q_OBJECT
33
35 Q_PROPERTY(QString terminal_name READ terminalName WRITE setTerminalName)
37
38 public:
39 // constructors, destructor
40 PartTerminal(QETElementEditor *editor, QGraphicsItem *parent = nullptr);
41 ~PartTerminal() override;
42 private:
44
45 signals:
49
50 // methods
51 public:
52 enum { Type = UserType + 1106 };
57 int type() const override { return Type; }
58 QString xmlName() const override { return(QString("terminal")); }
59 void fromXml(const QDomElement &) override;
60 const QDomElement toXml(QDomDocument &) const override;
61 void paint(
62 QPainter *painter,
63 const QStyleOptionGraphicsItem *,
64 QWidget *) override;
65
66 QPainterPath shape() const override;
67 QPainterPath shadowShape() const override {return shape();}
68 QRectF boundingRect() const override;
69 bool isUseless() const override;
70 QRectF sceneGeometricRect() const override;
71 void startUserTransformation(const QRectF &) override;
72 void handleUserTransformation(const QRectF &, const QRectF &) override;
73
74 Qet::Orientation orientation() const {return d -> m_orientation;}
76
77 qreal rotation() const;
78 void setRotation(qreal angle);
79
80
81 QString terminalName() const { return d -> m_name; }
82 void setTerminalName(const QString& name);
83
84 QString name() const override { return QObject::tr("Borne");}
85
88
89 void setNewUuid();
90
91 private:
92 void updateSecondPoint();
93 TerminalData* d; // pointer to the terminal data
94
95 private:
97};
98#endif
The CustomElementGraphicPart class This class is the base for all home-made primitive like line,...
Definition customelementgraphicpart.h:36
Definition partterminal.h:31
void updateSecondPoint()
Definition partterminal.cpp:215
TerminalData::Type terminal_type
Definition partterminal.h:36
void fromXml(const QDomElement &) override
Definition partterminal.cpp:48
void setRotation(qreal angle)
Definition partterminal.cpp:160
TerminalData::Type terminalType() const
Definition partterminal.h:86
bool isUseless() const override
Definition partterminal.cpp:232
void nameChanged()
void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) override
Definition partterminal.cpp:70
Qet::Orientation orientation
Definition partterminal.h:34
void terminalTypeChanged()
void handleUserTransformation(const QRectF &, const QRectF &) override
Definition partterminal.cpp:260
QPointF saved_position_
Definition partterminal.h:96
int type() const override
Definition partterminal.h:57
void setOrientation(Qet::Orientation ori)
Definition partterminal.cpp:148
Qet::Orientation orientation() const
Definition partterminal.h:74
QRectF sceneGeometricRect() const override
Definition partterminal.cpp:243
void orientationChanged()
QString name() const override
Definition partterminal.h:84
TerminalData * d
Definition partterminal.h:93
qreal rotation() const
Definition partterminal.cpp:172
QPainterPath shadowShape() const override
Definition partterminal.h:67
void setNewUuid()
Definition partterminal.cpp:206
QString terminalName() const
Definition partterminal.h:81
QRectF boundingRect() const override
PartTerminal::boundingRect.
Definition partterminal.cpp:133
void setTerminalType(TerminalData::Type type)
PartTerminal::setTerminalType Set the type of terminal to 'type'.
Definition partterminal.cpp:197
const QDomElement toXml(QDomDocument &) const override
Definition partterminal.cpp:59
void startUserTransformation(const QRectF &) override
Definition partterminal.cpp:252
QPainterPath shape() const override
PartTerminal::shape.
Definition partterminal.cpp:118
QString xmlName() const override
Definition partterminal.h:58
void setTerminalName(const QString &name)
PartTerminal::setTerminalName.
Definition partterminal.cpp:186
QString terminal_name
Definition partterminal.h:35
@ Type
Definition partterminal.h:52
Definition qetelementeditor.h:39
Orientation
Orientation (used for electrical elements and their terminals)
Definition qet.h:210
The TerminalData class Data of the terminal. Stored in extra class so it can be used by PartTerminal ...
Definition terminaldata.h:37
TerminalData::Type m_type
Definition terminaldata.h:113
Type
Definition terminaldata.h:41