Improve code style

This commit is contained in:
Simon De Backer
2020-08-16 14:25:14 +02:00
parent 5e3e3aa4bd
commit 6c806d151d
2 changed files with 9 additions and 9 deletions

View File

@@ -95,10 +95,10 @@ void XRefProperties::fromSettings(const QSettings &settings, const QString prefi
*/ */
QDomElement XRefProperties::toXml(QDomDocument &xml_document) const { QDomElement XRefProperties::toXml(QDomDocument &xml_document) const {
QDomElement xml_element = xml_document.createElement("xref"); QDomElement xml_element = xml_document.createElement("xref");
xml_element.setAttribute("type", m_key); xml_element.setAttribute("type", m_key);
xml_element.setAttribute("showpowerctc", m_show_power_ctc? "true" : "false"); xml_element.setAttribute("showpowerctc", m_show_power_ctc? "true" : "false");
QString display = m_display == Cross? "cross" : "contacts"; QString display = m_display == Cross? "cross" : "contacts";
xml_element.setAttribute("displayhas", display); xml_element.setAttribute("displayhas", display);
QString snap = m_snap_to == Bottom? "bottom" : "label"; QString snap = m_snap_to == Bottom? "bottom" : "label";
@@ -119,7 +119,7 @@ QDomElement XRefProperties::toXml(QDomDocument &xml_document) const {
xml_element.setAttribute(key + "prefix", m_prefix.value(key)); xml_element.setAttribute(key + "prefix", m_prefix.value(key));
} }
return xml_element; return xml_element;
} }
/** /**
@@ -149,7 +149,7 @@ bool XRefProperties::fromXml(const QDomElement &xml_element) {
foreach (QString key, m_prefix_keys) { foreach (QString key, m_prefix_keys) {
m_prefix.insert(key, xml_element.attribute(key + "prefix")); m_prefix.insert(key, xml_element.attribute(key + "prefix"));
} }
return true; return true;
} }
/** /**

View File

@@ -42,8 +42,8 @@ class XRefProperties : public PropertiesInterface
void toSettings (QSettings &settings, const QString = QString()) const override; void toSettings (QSettings &settings, const QString = QString()) const override;
void fromSettings (const QSettings &settings, const QString = QString()) override; void fromSettings (const QSettings &settings, const QString = QString()) override;
QDomElement toXml (QDomDocument &xml_document) const override; QDomElement toXml (QDomDocument &xml_document) const override;
bool fromXml(const QDomElement &xml_element) override; bool fromXml(const QDomElement &xml_element) override;
static QHash<QString, XRefProperties> defaultProperties(); static QHash<QString, XRefProperties> defaultProperties();
@@ -73,7 +73,7 @@ class XRefProperties : public PropertiesInterface
void setOffset(const int offset) {m_offset = offset;} void setOffset(const int offset) {m_offset = offset;}
int offset() const {return m_offset;} int offset() const {return m_offset;}
void setKey(QString& key) {m_key = key;} void setKey(QString& key) {m_key = key;}
private: private:
bool m_show_power_ctc; bool m_show_power_ctc;
@@ -85,7 +85,7 @@ class XRefProperties : public PropertiesInterface
QString m_master_label; QString m_master_label;
QString m_slave_label; QString m_slave_label;
int m_offset; int m_offset;
QString m_key; QString m_key;
}; };
#endif // XREFPROPERTIES_H #endif // XREFPROPERTIES_H