[Kst] extragear/graphics/kst/kst

Rick Chern rchern at interchange.ubc.ca
Tue Aug 16 19:07:18 CEST 2005


SVN commit 449767 by rchern:

Saving/loading of text labels now supported

 M  +18 -29    kstviewlabel.cpp  


--- trunk/extragear/graphics/kst/kst/kstviewlabel.cpp #449766:449767
@@ -70,30 +70,14 @@
 KstViewLabel::KstViewLabel(const QDomElement& e) 
   : KstBorderedViewObject(e) {
   
-  _autoResize = false;
-  _interpret = true;
-  _parsed = 0L;
-  _editDialog = 0L;
-  _justify = KST_JUSTIFY_H_LEFT;
-  _symbolFontName = "Symbol";
-  
-//   QDomNode n = e.firstChild();
-//   while (!n.isNull()) {
-//     QDomElement el = n.toElement(); 
-//     if (!el.isNull()) {
-//       if (metaObject()->findProperty(el.tagName().latin1(), true) > -1) {
-//         setProperty(el.tagName().latin1(), QVariant(el.text()));  
-//       }  
-//     }
-//     n = n.nextSibling();      
-//   }
-  
-  
+  // some defaults and invariants
+  _type = "Label";
   _dataPrecision = 8;
   _autoResize = false; // avoid madness
-  _txt = "lalala";
+  _txt = "Text";
   _interpret = true;
-  _rotation = 0;
+  _rotation = 0.0;
+  _justify = 0L;
   _fontName = KstApp::inst()->defaultFont();
   _symbolFontName = "Symbol";
   _fontSize = 20;
@@ -101,17 +85,22 @@
   _standardActions |= Delete | Edit;
   _parsed = 0L;
   _editDialog = 0L;
+  reparse();
   
+  // read the properties
+  QDomNode n = e.firstChild();
+  while (!n.isNull()) {
+    QDomElement el = n.toElement(); 
+    if (!el.isNull()) {
+      if (metaObject()->findProperty(el.tagName().latin1(), true) > -1) {
+        setProperty(el.tagName().latin1(), QVariant(el.text()));  
+      }  
+    }
+    n = n.nextSibling();      
+  }
   
-  // always have these values
-  _type = "Label";
-  _layoutActions |= Delete | Raise | Lower | RaiseToTop | LowerToBottom | Rename | Edit;
-  _standardActions |= Delete | Edit;
-  reparse();
-  computeTextSize(_parsed);
-  setDirty(false);
+  //reparse();
   _autoResize = true;
-  adjustSizeForText();
 }
 
 


More information about the Kst mailing list