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

Adam Treat treat at kde.org
Thu Jun 14 19:10:06 CEST 2007


SVN commit 675669 by treat:

* Proper painting of grips when scaled < 1


 M  +8 -10     viewitem.cpp  
 M  +1 -1      viewitem.h  


--- branches/work/kst/portto4/kst/src/libkstapp/viewitem.cpp #675668:675669
@@ -217,13 +217,8 @@
   if (!isSelected())
     return QGraphicsRectItem::boundingRect();
 
-  //FIXME this isn't enough since we don't take into consideration the transform on
-  // the sizeOfGrip...
-  QRectF bound = QGraphicsRectItem::boundingRect();
-  bound.setTopLeft(bound.topLeft() - QPoint(sizeOfGrip().width(), sizeOfGrip().height()));
-  bound.setWidth(bound.width() + sizeOfGrip().width());
-  bound.setHeight(bound.height() + sizeOfGrip().height());
-  return bound;
+  QPolygonF gripBound = mapFromScene(gripBoundingRect());
+  return QRectF(gripBound[0], gripBound[2]);
 }
 
 
@@ -668,9 +663,12 @@
 
 QVariant ViewItem::itemChange(GraphicsItemChange change, const QVariant &value) {
 
-  if (change == ItemSelectedChange && !value.toBool()) {
-    setMouseMode(ViewItem::Default);
-    update();
+  if (change == ItemSelectedChange) {
+    bool selected = value.toBool();
+    if (!selected) {
+      setMouseMode(ViewItem::Default);
+      update();
+    }
   }
 
   return QGraphicsItem::itemChange(change, value);
--- branches/work/kst/portto4/kst/src/libkstapp/viewitem.h #675668:675669
@@ -19,7 +19,7 @@
 #include "viewcommand.h"
 #include "view.h" //forward declare, but enums??
 
-#define DEBUG_GEOMETRY
+// #define DEBUG_GEOMETRY
 
 namespace Kst {
 


More information about the Kst mailing list