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