[Kst] extragear/graphics/kst/kst

Rick Chern rchern at interchange.ubc.ca
Thu Aug 18 21:14:39 CEST 2005


SVN commit 450674 by rchern:

load plots properly

 M  +13 -1     kstviewobject.cpp  


--- trunk/extragear/graphics/kst/kst/kstviewobject.cpp #450673:450674
@@ -151,7 +151,18 @@
     QDomElement el = n.toElement();
     if (!el.isNull()) {
       if (el.tagName() == "plot") {
-        QString in_tag = el.text();
+        // get the <tag> value properly
+        QString in_tag;
+        QDomNode plotNode = el.firstChild();
+        while (!plotNode.isNull()) {
+          QDomElement plotElem = plotNode.toElement(); 
+          if (!plotElem.isNull()) {
+            if (plotElem.tagName() == "tag") {
+              in_tag = plotElem.text();
+            }  
+          }
+          plotNode = plotNode.nextSibling();      
+        }
         if (KstApp::inst()->plotHolderWhileOpeningDocument().count(in_tag) > 0) {
           Kst2DPlotPtr plot = KstApp::inst()->plotHolderWhileOpeningDocument()[in_tag];
           if (plot) {
@@ -258,6 +269,7 @@
 void KstViewObject::saveTagOnce(QTextStream& ts, const QString& indent) {
   QString l2 = indent + "  ";
   ts << indent << "<" << type() << ">" << endl;
+  ts << l2 << "<tag>" << QStyleSheet::escape(tagName()) << "</tag>" << endl;
   for (KstViewObjectList::Iterator i = _children.begin(); i != _children.end(); ++i) {
     if ((*i)->type() == "plot") {
       (*i)->saveTagOnce(ts, indent); // special case: only save tags for plots when they are children  


More information about the Kst mailing list