mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-23 02:10:52 +01:00
initial work to move everything into the propertiesinterface which is related to it
This commit is contained in:
@@ -43,17 +43,11 @@ QDomElement TerminalData::toXml(QDomDocument &xml_document) const
|
||||
{
|
||||
QDomElement xml_element = xml_document.createElement("terminal");
|
||||
|
||||
// ecrit la position de la borne
|
||||
xml_element.setAttribute("x", QString("%1").arg(q->scenePos().x()));
|
||||
xml_element.setAttribute("y", QString("%1").arg(q->scenePos().y()));
|
||||
|
||||
|
||||
xml_element.setAttribute("uuid", m_uuid.toString());
|
||||
xml_element.setAttribute("name", m_name);
|
||||
|
||||
// ecrit l'orientation de la borne
|
||||
xml_element.setAttribute("orientation", Qet::orientationToString(m_orientation));
|
||||
// Write name and number to XML
|
||||
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.toString()));
|
||||
xml_element.appendChild(createXmlProperty(xml_document, "name", m_name));
|
||||
xml_element.appendChild(createXmlProperty(xml_document, "orientation", orientationToString(m_orientation)));
|
||||
|
||||
return(xml_element);
|
||||
}
|
||||
@@ -61,27 +55,40 @@ bool TerminalData::fromXml (const QDomElement &xml_element)
|
||||
{
|
||||
// lit la position de la borne
|
||||
qreal term_x = 0.0, term_y = 0.0;
|
||||
if (!QET::attributeIsAReal(xml_element, "x", &term_x))
|
||||
|
||||
if (!propertyDouble(xml_element, "x", &term_x))
|
||||
return false;
|
||||
|
||||
if (!QET::attributeIsAReal(xml_element, "y", &term_y))
|
||||
if (!propertyDouble(xml_element, "y", &term_y))
|
||||
return false;
|
||||
|
||||
m_pos = QPointF(term_x, term_y);
|
||||
|
||||
//emit posFromXML(QPointF(term_x, term_y));
|
||||
|
||||
QString uuid = xml_element.attribute("uuid");
|
||||
QString uuid;
|
||||
if (!propertyString(xml_element, "uuid", &uuid))
|
||||
return false;
|
||||
|
||||
// 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 (!uuid.isEmpty())
|
||||
m_uuid = QUuid(uuid);
|
||||
|
||||
m_name = xml_element.attribute("name");
|
||||
if (!propertyString(xml_element, "name", &m_name))
|
||||
return false;
|
||||
|
||||
QString o;
|
||||
if (!propertyString(xml_element, "orientation", &o))
|
||||
return false;
|
||||
|
||||
// lit l'orientation de la borne
|
||||
m_orientation = Qet::orientationFromString(xml_element.attribute("orientation"));
|
||||
m_orientation = orientationFromString(o);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TerminalData::valideXml(QDomElement& element) const {
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user