diff --git a/sources/diagram.cpp b/sources/diagram.cpp index 6aaa20cf3..81bd564a8 100644 --- a/sources/diagram.cpp +++ b/sources/diagram.cpp @@ -1009,10 +1009,10 @@ bool Diagram::fromXml(QDomElement &document, QPointF position, bool consider_inf } } } - //Load all elements from the XML + //Load all elements from the collection in the XML QList added_elements; QHash table_adr_id; - foreach (QDomElement element_xml, QET::findInDomElement(root, "elements", "element")) + foreach (QDomElement element_xml, QET::findInDomElement(root, "elements", "element")) // read all elements from the diagram { if (!Element::valideXml(element_xml)) continue; @@ -1027,7 +1027,8 @@ bool Diagram::fromXml(QDomElement &document, QPointF position, bool consider_inf } int state = 0; - Element *nvel_elmt = ElementFactory::Instance() -> createElement(element_location, nullptr, &state); // read element definition! + // Create element from the collection + Element *nvel_elmt = ElementFactory::Instance() -> createElement(element_location, nullptr, &state); // read element definition from the collection! if (state) { QString debug_message = QString("Diagram::fromXml() : Le chargement de la description de l'element %1 a echoue avec le code d'erreur %2").arg(element_location.path()).arg(state); @@ -1038,7 +1039,7 @@ bool Diagram::fromXml(QDomElement &document, QPointF position, bool consider_inf addItem(nvel_elmt); //Loading fail, remove item from the diagram - if (!nvel_elmt->fromXml(element_xml, table_adr_id, handle_inputs_rotation)) + if (!nvel_elmt->fromXml(element_xml, table_adr_id, handle_inputs_rotation)) // load element definition from the diagram { removeItem(nvel_elmt); delete nvel_elmt; diff --git a/sources/qetgraphicsitem/element.cpp b/sources/qetgraphicsitem/element.cpp index 7ff42a6d6..2df97d364 100644 --- a/sources/qetgraphicsitem/element.cpp +++ b/sources/qetgraphicsitem/element.cpp @@ -85,7 +85,7 @@ Element::Element(const ElementsLocation &location, QGraphicsItem *parent, int *s } int elmt_state; qDebug() << "\tCollection Path: " << location.collectionPath(); - buildFromXml(location.xml(), &elmt_state); + buildFromXml(location.xml(), &elmt_state); // build from the collection definition if (state) { *state = elmt_state; } @@ -338,7 +338,7 @@ void Element::drawHighlight(QPainter *painter, const QStyleOptionGraphicsItem *o /** * @brief Element::buildFromXml - * Build this element from an xml description + * Build this element from an xml description (from the collection) * @param xml_def_elmt * @param state * Optional pointer which define the status of build @@ -638,7 +638,7 @@ bool Element::fromXml(QDomElement &e, QHash &table_id_adr, bool les bornes vont maintenant etre recensees pour associer leurs id a leur adresse reelle ce recensement servira lors de la mise en place des fils */ - QList liste_terminals; + QList liste_terminals; // terminals in the element in the diagram foreach(QDomElement qde, QET::findInDomElement(e, "terminals", "terminal")) { if (Terminal::valideXml(qde)) liste_terminals << qde; } @@ -647,7 +647,7 @@ bool Element::fromXml(QDomElement &e, QHash &table_id_adr, bool int terminals_non_trouvees = 0; // The added childs from the collection now must match with the terminals from the diagram. Iterate through // all Terminals in the collection and in the diagram to link them together - foreach(QGraphicsItem *qgi, childItems()) { // Where the Terminals are added as childs? + for(QGraphicsItem *qgi: childItems()) { // TODO: Where the Terminals are added as childs? if (Terminal *p = qgraphicsitem_cast(qgi)) { bool terminal_trouvee = false; foreach(QDomElement qde, liste_terminals) {