[Kst] extragear/graphics/kst/kst

George Staikos staikos at kde.org
Fri Dec 16 22:19:20 CET 2005


SVN commit 489032 by staikos:

putting these properties in the right place (line) makes lines load closer to
correctly.  also set dirty when the arrow changes.


 M  +17 -26    kstviewarrow.cpp  
 M  +20 -1     kstviewline.cpp  


--- trunk/extragear/graphics/kst/kst/kstviewarrow.cpp #489031:489032
@@ -36,39 +36,18 @@
 
 KstViewArrow::KstViewArrow(const QDomElement& e)
 : KstViewLine(e) {
-
-  int orientationInt = 0;
-  
   QDomNode n = e.firstChild();
   while (!n.isNull()) {
     QDomElement el = n.toElement(); 
     if (!el.isNull()) {
-      if (el.tagName() == "orientation") {
-        orientationInt = el.text().toInt();
-      } else if (metaObject()->findProperty(el.tagName().latin1(), true) > -1) {
+      if (metaObject()->findProperty(el.tagName().latin1(), true) > -1) {
         setProperty(el.tagName().latin1(), QVariant(el.text()));  
       }  
     }
     n = n.nextSibling();      
   }
   
-  switch (orientationInt) {
-    case 1:
-      _orientation = UpRight;
-      break;
-    case 2:
-      _orientation = DownLeft;
-      break;
-    case 3:
-      _orientation = DownRight;
-      break;
-    case 0:
-    default:
-      _orientation = UpLeft;  
-  }
- 
   // always has this value
-  setTransparent(true);
   _type = "Arrow";
 }
 
@@ -214,7 +193,10 @@
 
 
 void KstViewArrow::setHasFromArrow(bool yes) {
-  _hasFromArrow = yes;  
+  if (_hasFromArrow != yes) {
+    _hasFromArrow = yes;  
+    setDirty();
+  }
 }
 
 
@@ -224,7 +206,10 @@
 
 
 void KstViewArrow::setHasToArrow(bool yes) {
-  _hasToArrow = yes;  
+  if (_hasToArrow != yes) {
+    _hasToArrow = yes;  
+    setDirty();
+  }
 }
 
 
@@ -237,7 +222,10 @@
   if (scaling < 1.0) {
     scaling = 1.0;  
   }  
-  _fromArrowScaling = scaling;
+  if (_fromArrowScaling != scaling) {
+    _fromArrowScaling = scaling;
+    setDirty();
+  }
 }
 
 
@@ -250,7 +238,10 @@
   if (scaling < 1.0) {
     scaling = 1.0;  
   }  
-  _toArrowScaling = scaling;
+  if (_toArrowScaling != scaling) {
+    _toArrowScaling = scaling;
+    setDirty();
+  }
 }
 
 
--- trunk/extragear/graphics/kst/kst/kstviewline.cpp #489031:489032
@@ -44,21 +44,40 @@
   _container = false;
   _capStyle = Qt::FlatCap; 
   _penStyle = Qt::SolidLine;
+  int orientationInt = 0;
   QDomNode n = e.firstChild();
   while (!n.isNull()) {
     QDomElement el = n.toElement(); 
     if (!el.isNull()) {
-      if (metaObject()->findProperty(el.tagName().latin1(), true) > -1) {
+      if (el.tagName() == "orientation") {
+        orientationInt = el.text().toInt();
+      } else if (metaObject()->findProperty(el.tagName().latin1(), true) > -1) {
         setProperty(el.tagName().latin1(), QVariant(el.text()));  
       }
     }
     n = n.nextSibling();
   }
   
+  switch (orientationInt) {
+    case 1:
+      _orientation = UpRight;
+      break;
+    case 2:
+      _orientation = DownLeft;
+      break;
+    case 3:
+      _orientation = DownRight;
+      break;
+    case 0:
+    default:
+      _orientation = UpLeft;  
+  }
+
   // always these values
   setTransparent(true);
   _type = "Line";
   setMinimumSize(QSize(1, 1));
+  updateOrientation();
 }
 
 


More information about the Kst mailing list