[Kst] branches/work/kst/1.5/kst/src/libkstmath

Andrew Walker arwalker at sumusltd.com
Fri Sep 14 23:48:08 CEST 2007


SVN commit 712606 by arwalker:

provide more robust line type

 M  +3 -4      kstlinestyle.cpp  
 M  +1 -1      kstlinestyle.h  
 M  +5 -3      kstvcurve.cpp  


--- branches/work/kst/1.5/kst/src/libkstmath/kstlinestyle.cpp #712605:712606
@@ -17,9 +17,7 @@
 
 #include "kstlinestyle.h"
 
-const unsigned int KSTLINESTYLE_MAXTYPE = 5;
-
-Qt::PenStyle KstLineStyle[KSTLINESTYLE_MAXTYPE] = { 
+Qt::PenStyle KstLineStyle[] = { 
   Qt::SolidLine, 
   Qt::DashLine, 
   Qt::DotLine, 
@@ -27,4 +25,5 @@
   Qt::DashDotDotLine
 };
 
-// vim: ts=2 sw=2 et
+const unsigned int KSTLINESTYLE_MAXTYPE = sizeof(KstLineStyle) / sizeof (Qt::PenStyle);
+
--- branches/work/kst/1.5/kst/src/libkstmath/kstlinestyle.h #712605:712606
@@ -28,4 +28,4 @@
 #define KSTLINEWIDTH_MAX        5
 
 #endif
-// vim: ts=2 sw=2 et
+
--- branches/work/kst/1.5/kst/src/libkstmath/kstvcurve.cpp #712605:712606
@@ -796,9 +796,11 @@
 
 
 void KstVCurve::setLineStyle(int in_LineStyle) {
-  LineStyle = in_LineStyle;
-  setDirty();
-  emit modifiedLegendEntry();
+  if (in_LineStyle >= 0 && (unsigned int)in_LineStyle < KSTLINESTYLE_MAXTYPE) {
+    LineStyle = in_LineStyle;
+    setDirty();
+    emit modifiedLegendEntry();
+  }
 }
 
 


More information about the Kst mailing list