[Kst] branches/work/kst/portto4/kst/src/libkstapp

Mike Fenton mike at staikos.net
Thu Jun 18 16:37:58 CEST 2009


SVN commit 983606 by fenton:

Fix inverse drawing of plots creating an invalid PlotRenderItem size.
Prevent drawing attempts of invalid PlotRenderItems.
Standardize all Plots after the final draw of the PlotItem and only if rect() is valid.


 M  +1 -1      plotitem.cpp  
 M  +3 -0      plotrenderitem.cpp  
 M  +12 -1     viewitem.cpp  


--- branches/work/kst/portto4/kst/src/libkstapp/plotitem.cpp #983605:983606
@@ -670,7 +670,7 @@
 
 
 void PlotItem::paintPixmap(QPainter *painter) {
-  if (parentView()->plotBordersDirty() || (creationState() == ViewItem::InProgress)) {
+  if ((parentView()->plotBordersDirty() || (creationState() == ViewItem::InProgress)) && rect().isValid()) {
     ViewGridLayout::standardizePlotMargins(this, painter);
     setPlotBordersDirty(false);
   }
--- branches/work/kst/portto4/kst/src/libkstapp/plotrenderitem.cpp #983605:983606
@@ -246,6 +246,9 @@
 
 
 void PlotRenderItem::paint(QPainter *painter) {
+  if (!rect().isValid()) {
+    return;
+  }
   painter->setRenderHint(QPainter::Antialiasing, false);
 
 #ifdef CURVE_DRAWING_TIME
--- branches/work/kst/portto4/kst/src/libkstapp/viewitem.cpp #983605:983606
@@ -831,8 +831,19 @@
     QRectF newRect(rect().x(), rect().y(),
                    poly.last().x() - rect().x(),
                    poly.last().y() - rect().y());
-    setViewRect(newRect.normalized());
 
+    if (!newRect.isValid())
+      newRect = newRect.normalized();
+      setPos(pos() + newRect.topLeft());
+
+      newRect.moveTopLeft(QPointF(0, 0));
+      setViewRect(newRect);
+
+      parentView()->setPlotBordersDirty(true);
+    } else {
+      setViewRect(newRect.normalized());
+    }
+
     parentView()->disconnect(this, SLOT(deleteLater())); //Don't delete ourself
     parentView()->disconnect(this, SLOT(creationPolygonChanged(View::CreationEvent)));
     parentView()->setMouseMode(View::Default);


More information about the Kst mailing list