mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-23 02:10:52 +01:00
Revert Martin pull request for now, and return to last 7e9fd8df9 commit
This commit is contained in:
@@ -23,7 +23,6 @@
|
||||
#include "elementprovider.h"
|
||||
#include "diagramposition.h"
|
||||
#include "terminal.h"
|
||||
#include "terminaldata.h"
|
||||
#include "PropertiesEditor/propertieseditordialog.h"
|
||||
#include "elementpropertieswidget.h"
|
||||
#include "numerotationcontextcommands.h"
|
||||
@@ -561,22 +560,36 @@ DynamicElementTextItem *Element::parseDynamicText(const QDomElement &dom_element
|
||||
return deti;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Element::parseTerminal
|
||||
* Parse partTerminal from xml structure
|
||||
* \param dom_element
|
||||
* \return
|
||||
*/
|
||||
Terminal *Element::parseTerminal(const QDomElement &dom_element)
|
||||
{
|
||||
|
||||
TerminalData* data = new TerminalData();
|
||||
if (!data->fromXml(dom_element)) {
|
||||
delete data;
|
||||
return nullptr;
|
||||
}
|
||||
qreal terminalx, terminaly;
|
||||
Qet::Orientation terminalo;
|
||||
if (!QET::attributeIsAReal(dom_element, QString("x"), &terminalx)) {
|
||||
return(nullptr);
|
||||
}
|
||||
if (!QET::attributeIsAReal(dom_element, QString("y"), &terminaly)) {
|
||||
return(nullptr);
|
||||
}
|
||||
if (!dom_element.hasAttribute("orientation")) {
|
||||
return(nullptr);
|
||||
}
|
||||
if (dom_element.attribute("orientation") == "n") {
|
||||
terminalo = Qet::North;
|
||||
}
|
||||
else if (dom_element.attribute("orientation") == "s") {
|
||||
terminalo = Qet::South;
|
||||
}
|
||||
else if (dom_element.attribute("orientation") == "e") {
|
||||
terminalo = Qet::East;
|
||||
}
|
||||
else if (dom_element.attribute("orientation") == "w") {
|
||||
terminalo = Qet::West;
|
||||
}
|
||||
else {
|
||||
return(nullptr);
|
||||
}
|
||||
|
||||
Terminal *new_terminal = new Terminal(data, this);
|
||||
Terminal *new_terminal = new Terminal(terminalx, terminaly, terminalo, this);
|
||||
m_terminals << new_terminal;
|
||||
|
||||
//Sort from top to bottom and left to rigth
|
||||
@@ -1047,7 +1060,7 @@ QDomElement Element::toXml(QDomDocument &document, QHash<Terminal *, int> &table
|
||||
foreach(Terminal *t, terminals()) {
|
||||
// alors on enregistre la borne
|
||||
QDomElement terminal = t -> toXml(document);
|
||||
terminal.setAttribute("id", id_terminal); // for backward compatibility
|
||||
terminal.setAttribute("id", id_terminal);
|
||||
table_adr_id.insert(t, id_terminal ++);
|
||||
xml_terminals.appendChild(terminal);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user