mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-01-09 07:09:59 +01:00
write uuid only in partterminal to xml, because in the other case it is not needed
This commit is contained in:
@@ -44,6 +44,14 @@ PartTerminal::~PartTerminal() {
|
||||
@param xml_elmt Element XML a lire
|
||||
*/
|
||||
bool PartTerminal::fromXml(const QDomElement &xml_elmt) {
|
||||
|
||||
QUuid uuid;
|
||||
// update part and add uuid, which is used in the new version to connect terminals together
|
||||
// if the attribute not exists, means, the element is created with an older version of qet. So use the legacy approach
|
||||
// to identify terminals
|
||||
if (propertyUuid(xml_elmt, "uuid", &uuid) == PropertyFlags::Success)
|
||||
d->m_uuid = QUuid(uuid);
|
||||
|
||||
if (!d->fromXml(xml_elmt))
|
||||
return false;
|
||||
|
||||
@@ -59,7 +67,18 @@ bool PartTerminal::fromXml(const QDomElement &xml_elmt) {
|
||||
@return un element XML decrivant la borne
|
||||
*/
|
||||
QDomElement PartTerminal::toXml(QDomDocument &xml_document) const {
|
||||
return d->toXml(xml_document);
|
||||
|
||||
QDomElement qdo = xml_document.createElement("terminal");
|
||||
|
||||
qdo.appendChild(createXmlProperty(xml_document, "uuid", d->m_uuid));
|
||||
|
||||
// Do not store terminal data in its own child
|
||||
QDomElement terminalDataElement = d->toXml(xml_document);
|
||||
for (int i=0; i < terminalDataElement.childNodes().length(); i++) {
|
||||
qdo.appendChild(terminalDataElement.childNodes().at(i));
|
||||
}
|
||||
|
||||
return qdo;
|
||||
}
|
||||
|
||||
bool PartTerminal::valideXml(QDomElement& element) {
|
||||
|
||||
@@ -45,7 +45,6 @@ QDomElement TerminalData::toXml(QDomDocument &xml_document) const
|
||||
|
||||
xml_element.appendChild(createXmlProperty(xml_document, "x", q->scenePos().x()));
|
||||
xml_element.appendChild(createXmlProperty(xml_document, "y", q->scenePos().y()));
|
||||
xml_element.appendChild(createXmlProperty(xml_document, "uuid", m_uuid));
|
||||
xml_element.appendChild(createXmlProperty(xml_document, "name", m_name));
|
||||
xml_element.appendChild(createXmlProperty(xml_document, "orientation", orientationToString(m_orientation)));
|
||||
|
||||
@@ -66,12 +65,8 @@ bool TerminalData::fromXml (const QDomElement &xml_element) // RETURNS True
|
||||
|
||||
// emit posFromXML(QPointF(term_x, term_y));
|
||||
|
||||
QUuid uuid;
|
||||
// update part and add uuid, which is used in the new version to connect terminals together
|
||||
// if the attribute not exists, means, the element is created with an older version of qet. So use the legacy approach
|
||||
// to identify terminals
|
||||
if (propertyUuid(xml_element, "uuid", &uuid) == PropertyFlags::Success)
|
||||
m_uuid = QUuid(uuid);
|
||||
// do not write uuid from this class, because only PartTerminal::fromXml need
|
||||
// to write it to xml file. Terminal::fromXml does not need.
|
||||
|
||||
|
||||
//if (propertyString(xml_element, "name", &m_name))
|
||||
|
||||
Reference in New Issue
Block a user