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

Mike Fenton mike at staikos.net
Fri Apr 24 16:28:00 CEST 2009


SVN commit 958729 by fenton:

Fix saving of PlotRenderItems and add saving of child viewItems.


 M  +15 -3     plotrenderitem.cpp  


--- branches/work/kst/portto4/kst/src/libkstapp/plotrenderitem.cpp #958728:958729
@@ -168,15 +168,23 @@
   xml.writeAttribute("type", QVariant(_type).toString());
   if (_referencePointMode) {
     xml.writeStartElement("referencepoint");
+    xml.writeAttribute("x", QVariant(_referencePoint.x()).toString());
+    xml.writeAttribute("y", QVariant(_referencePoint.y()).toString());
+    xml.writeEndElement();
   }
-  xml.writeAttribute("x", QVariant(_referencePoint.x()).toString());
-  xml.writeAttribute("y", QVariant(_referencePoint.y()).toString());
-  xml.writeEndElement();
   foreach (RelationPtr relation, relationList()) {
     xml.writeStartElement("relation");
     xml.writeAttribute("tag", relation->Name());
     xml.writeEndElement();
   }
+  QList<QGraphicsItem*> list = QGraphicsItem::children();
+  foreach (QGraphicsItem *item, list) {
+    ViewItem *viewItem = qgraphicsitem_cast<ViewItem*>(item);
+    if (!viewItem)
+      continue;
+
+    viewItem->save(xml);
+  }
 }
 
 
@@ -213,6 +221,10 @@
         y = av.toString().toDouble();
      }
      setReferencePoint(QPointF(x, y));
+    } else if (xml.isStartElement()) {
+      if (!parse(xml, validTag) && validTag) {
+        ViewItem *i = GraphicsFactory::parse(xml, store, parentView(), this);
+      }
     } else if (xml.isEndElement()) {
       if (xml.name().toString() != expectedEnd) {
         validTag = false;


More information about the Kst mailing list