void DiagramScene::loadDiagram() { QDomNodeList lst = projXml->elementsByTagName("item"); for(int i=0;i<lst.count();i++) { QDomNode xmlNode = lst.at(i); QDomNamedNodeMap attr = xmlNode.attributes(); int type = attr.namedItem("type").nodeValue().toInt(); int id = attr.namedItem("id").nodeValue().toInt(); int diagId = attr.namedItem("diagId").nodeValue().toInt(); qreal x = attr.namedItem("x").nodeValue().toDouble(); qreal y = attr.namedItem("y").nodeValue().toDouble(); DiagramNode nod = ((DiagramWindow*)parent())->searchById(type,id); DiagramItem* item = new DiagramItem(((DiagramItem::DiagramType)type), myItemMenu, nod.name, xmlNode, diagId, nod.inputs); item->setPos(x,y); diagItems.append(item); addItem(item); } QDomNodeList lst2 = projXml->elementsByTagName("arrow"); for(int i=0;i<lst2.count();i++) { QDomNamedNodeMap attr = lst2.at(i).attributes(); DiagramItem* startParent = getItemById(attr.namedItem("parentInId").nodeValue().toInt()); DiagramItem* endParent = getItemById(attr.namedItem("parentOutId").nodeValue().toInt()); Connector* start = startParent->childAt(attr.namedItem("connectorInId").nodeValue().toInt()); Connector* end = endParent->childAt(attr.namedItem("connectorOutId").nodeValue().toInt()); Arrow *arrow = new Arrow(start, end,lst2.at(i)); arrowList.append(arrow); arrow->setColor(myLineColor); start->addArrow(arrow); end->addArrow(arrow); addItem(arrow); arrow->setZValue(-1000.0); arrow->updatePosition(); } for(int i=0;i<diagItems.count();i++) { diagItems.at(i)->updateId(itemCount); itemCount++; } }