QElectroTech  0.70
xrefproperties.h
Go to the documentation of this file.
1 /*
2  Copyright 2006-2019 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 {
36  };
37 
38  enum SnapTo {
41  };
42 
43  void toSettings (QSettings &settings, const QString = QString()) const override;
44  void fromSettings (const QSettings &settings, const QString = QString()) override;
45  void toXml (QDomElement &xml_element) const override;
46  void fromXml (const QDomElement &xml_element) override;
47 
48  static QHash<QString, XRefProperties> defaultProperties();
49 
50  bool operator == (const XRefProperties &xrp) const;
51  bool operator != (const XRefProperties &xrp) const;
52 
53  void setShowPowerContac (const bool a) {m_show_power_ctc = a;}
54  bool showPowerContact () const {return m_show_power_ctc;}
55 
56  void setDisplayHas (const DisplayHas dh) {m_display = dh;}
57  DisplayHas displayHas () const {return m_display;}
58 
59  void setSnapTo (const SnapTo st) {m_snap_to = st;}
60  SnapTo snapTo () const {return m_snap_to;}
61 
62  void setPrefix (const QString &key, const QString &value) {m_prefix.insert(key, value);}
63  QString prefix (const QString &key) const {return m_prefix.value(key);}
64 
65  void setMasterLabel (const QString master) {m_master_label = master;}
66  QString masterLabel () const {return m_master_label;}
67 
68  void setSlaveLabel(const QString slave) {m_slave_label = slave;}
69  QString slaveLabel () const {return m_slave_label;}
70 
71  void setOffset(const int offset) {m_offset = offset;}
72  int offset() const {return m_offset;}
73 
74  private:
78  QHash <QString, QString> m_prefix;
79  QStringList m_prefix_keys;
80  QString m_master_label;
81  QString m_slave_label;
82  int m_offset;
83 };
84 
85 #endif // XREFPROPERTIES_H
void setMasterLabel(const QString master)
QString prefix(const QString &key) const
DisplayHas m_display
The XRefProperties class this class store properties used by XrefItem.
DisplayHas displayHas() const
void setSlaveLabel(const QString slave)
void setSnapTo(const SnapTo st)
QString slaveLabel() const
void fromSettings(const QSettings &settings, const QString=QString()) override
XRefProperties::fromSettings load from settings.
bool showPowerContact() const
QHash< QString, QString > m_prefix
static QHash< QString, XRefProperties > defaultProperties()
XRefProperties::defaultProperties.
QString m_master_label
QString masterLabel() const
void toSettings(QSettings &settings, const QString=QString()) const override
XRefProperties::toSettings Save to settings.
int offset() const
bool operator==(const XRefProperties &xrp) const
void toXml(QDomElement &xml_element) const override
XRefProperties::toXml Save to xml.
SnapTo snapTo() const
void setPrefix(const QString &key, const QString &value)
void fromXml(const QDomElement &xml_element) override
XRefProperties::fromXml Load from xml.
void setDisplayHas(const DisplayHas dh)
The PropertiesInterface class This class is an interface for have common way to use properties in QEl...
XRefProperties()
XRefProperties::XRefProperties Default Constructor.
bool operator!=(const XRefProperties &xrp) const
void setShowPowerContac(const bool a)
QStringList m_prefix_keys
QString m_slave_label
void setOffset(const int offset)