[Kst] branches/work/kst/2.0.0-beta2/kst/src

Mike Fenton mike at staikos.net
Thu May 7 15:54:02 CEST 2009


SVN commit 964856 by fenton:

Fix cosmetic pen based crashes on Windows.


 M  +5 -0      libkstapp/viewitemdialog.cpp  
 M  +5 -0      libkstmath/curve.cpp  
 M  +2 -2      libkstmath/image.cpp  
 M  +6 -1      widgets/curveappearance.cpp  


--- branches/work/kst/2.0.0-beta2/kst/src/libkstapp/viewitemdialog.cpp #964855:964856
@@ -153,6 +153,11 @@
   p.setJoinStyle(_strokeTab->joinStyle());
   p.setCapStyle(_strokeTab->capStyle());
   p.setBrush(b);
+#ifdef Q_WS_WIN32
+  if (p.isCosmetic()) {
+    p.setWidth(1);
+  }
+#endif
   _item->setPen(p);
 }
 
--- branches/work/kst/2.0.0-beta2/kst/src/libkstmath/curve.cpp #964855:964856
@@ -584,6 +584,11 @@
 
 
 void Curve::setLineWidth(int in_LineWidth) {
+#ifdef Q_WS_WIN32
+  if (in_LineWidth == 0) {
+    in_LineWidth = 1;
+  }
+#endif
   LineWidth = in_LineWidth;
 }
 
--- branches/work/kst/2.0.0-beta2/kst/src/libkstmath/image.cpp #964855:964856
@@ -766,13 +766,13 @@
     for (int i = l; i <= r; i++) {
       int index = (int)floor(static_cast<double>(((i - l) * (_pal.paletteData().count() - 1))) / (r - l));
       QColor sliceColor = _pal.paletteData().value(index).rgb();
-      p->setPen(QPen(sliceColor, 0));
+      p->setPen(QPen(sliceColor, 1));
       p->drawLine(i, t, i, b);
     }
   }
   if (hasContourMap()) {
     // draw a box with contour color
-    p->setPen(QPen(_contourColor, 0));
+    p->setPen(QPen(_contourColor, 1));
     p->drawRect(bound.left(), bound.top(), bound.width(), bound.height());
   }
 }
--- branches/work/kst/2.0.0-beta2/kst/src/widgets/curveappearance.cpp #964855:964856
@@ -331,7 +331,7 @@
   if (lineColor == Qt::transparent) {
     lineColor = Qt::black;
   }
-  QPen pen(lineColor, 0);
+  QPen pen(lineColor, 1);
 
   int currentItem = _comboLineStyle->currentIndex();
   _comboLineStyle->clear();
@@ -372,6 +372,11 @@
     p.drawRect(rectBar);
   }
 
+#ifdef Q_WS_WIN32
+  if (pen.isCosmetic()) {
+    pen.setWidth(1);
+  }
+#endif
   p.setPen(pen);
   if (showLines()) {
     p.drawLine(1, pix.height()/2, pix.width()-1, pix.height()/2);


More information about the Kst mailing list