QElectroTech 0.100.0-dev
Loading...
Searching...
No Matches
terminaldata.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 TERMINALDATA_H
19#define TERMINALDATA_H
20
21#include "../qet.h"
22#include "propertiesinterface.h"
23
24#include <QPointF>
25#include <QUuid>
26
27class QGraphicsObject;
28
37{
38 Q_GADGET
39
40 public:
46 Q_ENUM(Type)
47
49 TerminalData(QGraphicsObject* parent);
50 ~TerminalData() override;
51
52 void init();
53
54 void setParent(QGraphicsObject* parent);
55 void toSettings(QSettings &settings,
56 const QString prefix = QString()) const override;
57 void fromSettings(const QSettings &settings,
58 const QString prefix = QString()) override;
59 QDomElement toXml(QDomDocument &xml_element) const override;
60 bool fromXml(const QDomElement &xml_element) override;
61
62 static QString typeToString(TerminalData::Type type);
63 static TerminalData::Type typeFromString(const QString &string);
64
65 // must be public, because this class is a private member
66 // of PartTerminal/Terminal and they must access this data
67 public:
93 QUuid m_uuid;
99 QString m_name;
100
111 QPointF m_pos;
112
114
115 private:
116 QGraphicsObject* q{nullptr};
117};
118
119#endif // TERMINALDATA_H
The PropertiesInterface class This class is an interface for have common way to use properties in QEl...
Definition propertiesinterface.h:31
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
void init()
Definition terminaldata.cpp:36
void setParent(QGraphicsObject *parent)
TerminalData::setParent.
Definition terminaldata.cpp:49
QGraphicsObject * q
Definition terminaldata.h:116
TerminalData::Type m_type
Definition terminaldata.h:113
QDomElement toXml(QDomDocument &xml_element) const override
TerminalData::toXml Save properties to xml element write the name, number, position and orientation o...
Definition terminaldata.cpp:95
TerminalData()
Definition terminaldata.cpp:23
static TerminalData::Type typeFromString(const QString &string)
TerminalData::typeFromString.
Definition terminaldata.cpp:184
~TerminalData() override
Definition terminaldata.cpp:40
void toSettings(QSettings &settings, const QString prefix=QString()) const override
TerminalData::toSettings Save properties to settings file.
Definition terminaldata.cpp:62
bool fromXml(const QDomElement &xml_element) override
TerminalData::fromXml load properties to xml element.
Definition terminaldata.cpp:122
QUuid m_uuid
m_uuid Uuid of the terminal.
Definition terminaldata.h:93
Type
Definition terminaldata.h:41
@ Generic
Definition terminaldata.h:42
@ Inner
Definition terminaldata.h:43
@ Outer
Definition terminaldata.h:44
QPointF m_second_point
second_point Position of the second point of the terminal in scene coordinates
Definition terminaldata.h:78
static QString typeToString(TerminalData::Type type)
TerminalData::typeToString.
Definition terminaldata.cpp:165
QPointF m_pos
m_pos Position of the terminal. The second point is calculated from this position and the orientation
Definition terminaldata.h:111
Qet::Orientation m_orientation
m_orientation Orientation of the terminal
Definition terminaldata.h:72
void fromSettings(const QSettings &settings, const QString prefix=QString()) override
TerminalData::fromSettings load properties to settings file.
Definition terminaldata.cpp:77
QString m_name
m_name Name of the element. It can be used to create wiring harness tables
Definition terminaldata.h:99