mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-23 02:10:52 +01:00
Add ability to store informations for element like label, manufacturer, ref etc....
Add widget to edit it, save/load works Informations are stored in a diagramcontext, this class was modified (new feature) to store information but keep compatibilty with older version. git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@2850 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
#include <QtDebug>
|
||||
#include <ui/elementpropertieswidget.h>
|
||||
#include "elementprovider.h"
|
||||
#include "elementsproperties.h"
|
||||
|
||||
/**
|
||||
Constructeur pour un element sans scene ni parent
|
||||
@@ -395,6 +396,9 @@ bool Element::fromXml(QDomElement &e, QHash<int, Terminal *> &table_id_adr, bool
|
||||
//uuid of this element
|
||||
uuid_= QUuid(e.attribute("uuid", QUuid::createUuid().toString()));
|
||||
|
||||
//load informations
|
||||
informations_.fromXml(e.firstChildElement("informations"), "information");
|
||||
|
||||
// position, selection
|
||||
setPos(e.attribute("x").toDouble(), e.attribute("y").toDouble());
|
||||
setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
|
||||
@@ -473,6 +477,11 @@ QDomElement Element::toXml(QDomDocument &document, QHash<Terminal *, int> &table
|
||||
}
|
||||
element.appendChild(links_uuids);
|
||||
}
|
||||
|
||||
//save information of this element
|
||||
QDomElement infos = document.createElement("informations");
|
||||
informations_.toXml(infos, "information");
|
||||
element.appendChild(infos);
|
||||
|
||||
return(element);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user