[Kst] branches/work/kst/portto4/kst/src/libkstapp

Mike Fenton mike at staikos.net
Mon Oct 15 17:55:06 CEST 2007


SVN commit 725514 by fenton:

Update to ViewItem save to include zvalue as attribute.


 M  +15 -8     viewitem.cpp  


--- branches/work/kst/portto4/kst/src/libkstapp/viewitem.cpp #725513:725514
@@ -68,6 +68,7 @@
 void ViewItem::save(QXmlStreamWriter &xml) {
 //  TODO Add proper writing of ObjectTag
 //   xml.writeAttribute("name", name());
+  xml.writeAttribute("zvalue", QVariant(zValue()).toString());
   xml.writeStartElement("position");
   xml.writeAttribute("x", QVariant(pos().x()).toString());
   xml.writeAttribute("y", QVariant(pos().y()).toString());
@@ -110,19 +111,25 @@
 bool ViewItem::parse(QXmlStreamReader &xml, bool &validChildTag) {
   bool knownTag = false;
   QString expectedTag;
+  bool processParentAttributes = true;
   if (xml.isStartElement()) {
     expectedTag = xml.name().toString();
     QXmlStreamAttributes attrs = xml.attributes();
     QStringRef av;
-    if (xml.name().toString() == "name") {
+    if (processParentAttributes) {
+      processParentAttributes = false;
+      av = attrs.value("name");
+      if (!av.isNull()) {
+  //         setName(av.toString());
+      }
+      av = attrs.value("zvalue");
+      if (!av.isNull()) {
+        setZValue(av.toString().toDouble());
+      }
+    }
+
+    if (xml.name().toString() == "position") {
       knownTag = true;
-//      TODO Add proper parsing of ObjectTag when format is set.
-//       av = attrs.value("name");
-//       if (!av.isNull()) {
-//         setName(av.toString());
-//      }
-    } else if (xml.name().toString() == "position") {
-      knownTag = true;
       double x = 0, y = 0;
       av = attrs.value("x");
       if (!av.isNull()) {


More information about the Kst mailing list