QElectroTech 0.200.1-dev
Loading...
Searching...
No Matches
terminaldata.h
Go to the documentation of this file.
1/*
2 Copyright 2006-2026 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 <QColor>
25#include <QFont>
26#include <QPointF>
27#include <QUuid>
28
29class QGraphicsObject;
30
39{
40 Q_GADGET
41
42 public:
51 Q_ENUM(Type)
52
54 TerminalData(QGraphicsObject* parent);
55 ~TerminalData() override;
56
57 void init();
58
59 void setParent(QGraphicsObject* parent);
60 void toSettings(QSettings &settings,
61 const QString prefix = QString()) const override;
62 void fromSettings(const QSettings &settings,
63 const QString prefix = QString()) override;
64 QDomElement toXml(QDomDocument &xml_element) const override;
65 bool fromXml(const QDomElement &xml_element) override;
66
67 static QString typeToString(TerminalData::Type type);
68 static TerminalData::Type typeFromString(const QString &string);
69
70 // must be public, because this class is a private member
71 // of PartTerminal/Terminal and they must access this data
72 public:
98 QUuid m_uuid;
104 QString m_name;
105
116 QPointF m_pos;
117
119
121 bool m_show_name = false;
123 QPointF m_label_pos{0.0, 0.0};
127 qreal m_label_rotation = 0.0;
129 Qt::Alignment m_label_halignment = Qt::AlignHCenter;
131 Qt::Alignment m_label_valignment = Qt::AlignVCenter;
133 bool m_label_frame = false;
135 QColor m_label_color = Qt::black;
136
138 bool m_use_master_label = false;
141
142 private:
143 QGraphicsObject* q{nullptr};
144};
145
146#endif // TERMINALDATA_H
PropertiesInterface()
PropertiesInterface::PropertiesInterface.
Definition propertiesinterface.cpp:23
Orientation
Orientation (used for electrical elements and their terminals).
Definition qet.h:211
void init()
Definition terminaldata.cpp:40
bool m_show_name
Whether to display the terminal name as a text label.
Definition terminaldata.h:121
void setParent(QGraphicsObject *parent)
TerminalData::setParent.
Definition terminaldata.cpp:54
Qt::Alignment m_label_halignment
Horizontal alignment of the text label.
Definition terminaldata.h:129
QGraphicsObject * q
Definition terminaldata.h:143
TerminalData::Type m_type
Definition terminaldata.h:118
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:100
TerminalData()
Definition terminaldata.cpp:27
bool m_use_master_label
Whether this terminal uses a label from the master's contact group.
Definition terminaldata.h:138
static TerminalData::Type typeFromString(const QString &string)
TerminalData::typeFromString.
Definition terminaldata.cpp:247
qreal m_label_rotation
Rotation of the text label in degrees.
Definition terminaldata.h:127
Qt::Alignment m_label_valignment
Vertical alignment of the text label.
Definition terminaldata.h:131
~TerminalData() override
Definition terminaldata.cpp:45
void toSettings(QSettings &settings, const QString prefix=QString()) const override
TerminalData::toSettings Save properties to settings file.
Definition terminaldata.cpp:67
bool fromXml(const QDomElement &xml_element) override
TerminalData::fromXml load properties to xml element.
Definition terminaldata.cpp:150
QPointF m_label_pos
Position of the text label relative to the terminal.
Definition terminaldata.h:123
QUuid m_uuid
m_uuid Uuid of the terminal.
Definition terminaldata.h:98
Type
Definition terminaldata.h:43
@ Nc
Normally Closed terminal (for SW contacts).
Definition terminaldata.h:48
@ Generic
Definition terminaldata.h:44
@ Inner
Definition terminaldata.h:45
@ Outer
Definition terminaldata.h:46
@ No
Normally Open terminal (for SW contacts).
Definition terminaldata.h:47
@ Common
Common terminal (for SW contacts).
Definition terminaldata.h:49
QFont m_label_font
Font used for the text label.
Definition terminaldata.h:125
QPointF m_second_point
second_point Position of the second point of the terminal in scene coordinates
Definition terminaldata.h:83
int m_master_label_index
Index into the master's contact group labels (T1=0, T2=1, ..., T20=19).
Definition terminaldata.h:140
static QString typeToString(TerminalData::Type type)
TerminalData::typeToString.
Definition terminaldata.cpp:222
bool m_label_frame
Whether to draw a frame around the text label.
Definition terminaldata.h:133
QPointF m_pos
m_pos Position of the terminal. The second point is calculated from this position and the orientation
Definition terminaldata.h:116
Qet::Orientation m_orientation
m_orientation Orientation of the terminal
Definition terminaldata.h:77
QColor m_label_color
Color of the text label.
Definition terminaldata.h:135
void fromSettings(const QSettings &settings, const QString prefix=QString()) override
TerminalData::fromSettings load properties to settings file.
Definition terminaldata.cpp:82
QString m_name
m_name Name of the element. It can be used to create wiring harness tables
Definition terminaldata.h:104