QElectroTech 0.100.0-dev
Loading...
Searching...
No Matches
xrefproperties.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 XREFPROPERTIES_H
19#define XREFPROPERTIES_H
20
21#include <QStringList>
22#include <QHash>
23
24#include "propertiesinterface.h"
25
31{
32 public:
34
39
40 enum SnapTo {
42 Label
43 };
44
45 void toSettings (QSettings &settings,
46 const QString = QString()) const override;
47 void fromSettings (const QSettings &settings,
48 const QString = QString()) override;
49 QDomElement toXml (QDomDocument &xml_document) const override;
50 bool fromXml(const QDomElement &xml_element) override;
51
52 static QHash<QString, XRefProperties> defaultProperties();
53
54 bool operator == (const XRefProperties &xrp) const;
55 bool operator != (const XRefProperties &xrp) const;
56
57 void setShowPowerContac (const bool a) {m_show_power_ctc = a;}
58 bool showPowerContact () const {return m_show_power_ctc;}
59
60 void setDisplayHas (const DisplayHas dh) {m_display = dh;}
61 DisplayHas displayHas () const {return m_display;}
62
63 void setSnapTo (const SnapTo st) {m_snap_to = st;}
64 SnapTo snapTo () const {return m_snap_to;}
65
66 void setXrefPos(const Qt::AlignmentFlag xref) {m_xref_pos = xref;}
67 Qt::AlignmentFlag getXrefPos() const {return m_xref_pos;}
68 void setPrefix (const QString &key, const QString &value) {m_prefix.insert(key, value);}
69 QString prefix (const QString &key) const {return m_prefix.value(key);}
70
71 void setMasterLabel (const QString master) {m_master_label = master;}
72 QString masterLabel () const {return m_master_label;}
73
74 void setSlaveLabel(const QString slave) {m_slave_label = slave;}
75 QString slaveLabel () const {return m_slave_label;}
76
77 void setOffset(const int offset) {m_offset = offset;}
78 int offset() const {return m_offset;}
79
80 void setKey(QString& key) {m_key = key;}
81
82 private:
86 Qt::AlignmentFlag m_xref_pos;
87 QHash <QString, QString> m_prefix;
88 QStringList m_prefix_keys;
92 QString m_key;
93};
94
95#endif // XREFPROPERTIES_H
The PropertiesInterface class This class is an interface for have common way to use properties in QEl...
Definition propertiesinterface.h:31
The XRefProperties class this class store properties used by XrefItem.
Definition xrefproperties.h:31
static QHash< QString, XRefProperties > defaultProperties()
XRefProperties::defaultProperties.
Definition xrefproperties.cpp:170
Qt::AlignmentFlag getXrefPos() const
Definition xrefproperties.h:67
QString prefix(const QString &key) const
Definition xrefproperties.h:69
int m_offset
Definition xrefproperties.h:91
SnapTo m_snap_to
Definition xrefproperties.h:85
bool operator==(const XRefProperties &xrp) const
Definition xrefproperties.cpp:189
bool m_show_power_ctc
Definition xrefproperties.h:83
DisplayHas displayHas() const
Definition xrefproperties.h:61
void setShowPowerContac(const bool a)
Definition xrefproperties.h:57
void setMasterLabel(const QString master)
Definition xrefproperties.h:71
SnapTo snapTo() const
Definition xrefproperties.h:64
void setOffset(const int offset)
Definition xrefproperties.h:77
void setPrefix(const QString &key, const QString &value)
Definition xrefproperties.h:68
QString masterLabel() const
Definition xrefproperties.h:72
QString m_master_label
Definition xrefproperties.h:89
Qt::AlignmentFlag m_xref_pos
Definition xrefproperties.h:86
void toSettings(QSettings &settings, const QString=QString()) const override
XRefProperties::toSettings Save to settings.
Definition xrefproperties.cpp:47
QString m_slave_label
Definition xrefproperties.h:90
SnapTo
Definition xrefproperties.h:40
@ Label
Definition xrefproperties.h:42
@ Bottom
Definition xrefproperties.h:41
bool operator!=(const XRefProperties &xrp) const
Definition xrefproperties.cpp:200
bool showPowerContact() const
Definition xrefproperties.h:58
QHash< QString, QString > m_prefix
Definition xrefproperties.h:87
bool fromXml(const QDomElement &xml_element) override
XRefProperties::fromXml Load from xml.
Definition xrefproperties.cpp:138
void fromSettings(const QSettings &settings, const QString=QString()) override
XRefProperties::fromSettings load from settings.
Definition xrefproperties.cpp:77
void setSnapTo(const SnapTo st)
Definition xrefproperties.h:63
QString m_key
Definition xrefproperties.h:92
void setDisplayHas(const DisplayHas dh)
Definition xrefproperties.h:60
DisplayHas m_display
Definition xrefproperties.h:84
QDomElement toXml(QDomDocument &xml_document) const override
XRefProperties::toXml Save to xml.
Definition xrefproperties.cpp:103
DisplayHas
Definition xrefproperties.h:35
@ Cross
Definition xrefproperties.h:36
@ Contacts
Definition xrefproperties.h:37
void setSlaveLabel(const QString slave)
Definition xrefproperties.h:74
QString slaveLabel() const
Definition xrefproperties.h:75
void setXrefPos(const Qt::AlignmentFlag xref)
Definition xrefproperties.h:66
QStringList m_prefix_keys
Definition xrefproperties.h:88
int offset() const
Definition xrefproperties.h:78
XRefProperties()
XRefProperties::XRefProperties Default Constructor.
Definition xrefproperties.cpp:29
void setKey(QString &key)
Definition xrefproperties.h:80