From b51d71f89746e0f8d2c5a0d7f8d1e4241af3aa2f Mon Sep 17 00:00:00 2001 From: blacksun Date: Fri, 7 Feb 2014 14:45:43 +0000 Subject: [PATCH] save/load conductor text for the 3 kinds of conductor git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@2820 bfdf4180-ca20-0410-9c96-a3a8aa849046 --- sources/conductorproperties.cpp | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/sources/conductorproperties.cpp b/sources/conductorproperties.cpp index cd35db0f9..71745282e 100644 --- a/sources/conductorproperties.cpp +++ b/sources/conductorproperties.cpp @@ -233,13 +233,15 @@ ConductorProperties::ConductorProperties() : ConductorProperties::~ConductorProperties() { } + /** - Exporte les parametres du conducteur sous formes d'attributs XML - ajoutes a l'element e. - @param e Element XML auquel seront ajoutes des attributs -*/ + * @brief ConductorProperties::toXml + * Export conductor propertie, in the XML element 'e' + * @param e the xml element + */ void ConductorProperties::toXml(QDomElement &e) const { e.setAttribute("type", typeToString(type)); + e.setAttribute("num", text); if (color != QColor(Qt::black)) { e.setAttribute("color", color.name()); @@ -248,7 +250,6 @@ void ConductorProperties::toXml(QDomElement &e) const { if (type == Single) { singleLineProperties.toXml(e); } else if (type == Multi) { - e.setAttribute("num", text); e.setAttribute("numsize", text_size); e.setAttribute("vertirotatetext", verti_rotate_text); e.setAttribute("horizrotatetext", horiz_rotate_text); @@ -260,13 +261,14 @@ void ConductorProperties::toXml(QDomElement &e) const { } } + /** - Importe les parametres du conducteur unifilaire a partir des attributs XML - de l'element e - @param e Element XML dont les attributs seront lus -*/ + * @brief ConductorProperties::fromXml + * Import conductor propertie, from the attribute of the xml element 'e' + * @param e the xml document + */ void ConductorProperties::fromXml(QDomElement &e) { - // recupere la couleur du conducteur + // get conductor color QColor xml_color= QColor(e.attribute("color")); if (xml_color.isValid()) { color = xml_color; @@ -274,18 +276,18 @@ void ConductorProperties::fromXml(QDomElement &e) { color = QColor(Qt::black); } - // lit le style du conducteur + // read style of conductor readStyle(e.attribute("style")); + // qet text field + text = e.attribute("num"); if (e.attribute("type") == typeToString(Single)) { - // recupere les parametres specifiques a un conducteur unifilaire + // get specific properties for single conductor singleLineProperties.fromXml(e); type = Single; } else if (e.attribute("type") == typeToString(Simple)) { type = Simple; } else { - // recupere le champ de texte - text = e.attribute("num"); text_size = e.attribute("numsize", QString::number(9)).toInt(); verti_rotate_text = e.attribute("vertirotatetext").toDouble(); horiz_rotate_text = e.attribute("horizrotatetext").toDouble();