regarding to joshuas email, toXml uses a new structure. So it is changed in the properties interface and xrefproperties

This commit is contained in:
Martin Marmsoler
2020-05-24 22:09:04 +02:00
committed by Laurent Trinques
parent ca80b3d69f
commit 8c6b4120f5
4 changed files with 21 additions and 12 deletions

View File

@@ -93,8 +93,12 @@ void XRefProperties::fromSettings(const QSettings &settings, const QString prefi
* Save to xml
* @param xml_element: QDomElement to use for saving
*/
void XRefProperties::toXml(QDomElement &xml_element) const {
xml_element.setAttribute("showpowerctc", m_show_power_ctc? "true" : "false");
QDomElement XRefProperties::toXml(QDomDocument &xml_document) const {
QDomElement xml_element = xml_document.createElement("xref");
xml_element.setAttribute("type", m_key);
xml_element.setAttribute("showpowerctc", m_show_power_ctc? "true" : "false");
QString display = m_display == Cross? "cross" : "contacts";
xml_element.setAttribute("displayhas", display);
QString snap = m_snap_to == Bottom? "bottom" : "label";
@@ -114,6 +118,8 @@ void XRefProperties::toXml(QDomElement &xml_element) const {
foreach (QString key, m_prefix.keys()) {
xml_element.setAttribute(key + "prefix", m_prefix.value(key));
}
return xml_element;
}
/**
@@ -121,7 +127,7 @@ void XRefProperties::toXml(QDomElement &xml_element) const {
* Load from xml
* @param xml_element: QDomElement to use for load
*/
void XRefProperties::fromXml(const QDomElement &xml_element) {
bool XRefProperties::fromXml(const QDomElement &xml_element) {
m_show_power_ctc = xml_element.attribute("showpowerctc") == "true";
QString display = xml_element.attribute("displayhas", "cross");
display == "cross"? m_display = Cross : m_display = Contacts;
@@ -143,6 +149,7 @@ void XRefProperties::fromXml(const QDomElement &xml_element) {
foreach (QString key, m_prefix_keys) {
m_prefix.insert(key, xml_element.attribute(key + "prefix"));
}
return true;
}
/**