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

Adam Treat treat at kde.org
Sun Jun 10 00:55:17 CEST 2007


SVN commit 673335 by treat:

* This is correct.  Draw the selection like inkscape
does with the true real bounding rect.


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


--- branches/work/kst/portto4/kst/src/libkstapp/viewitem.cpp #673334:673335
@@ -50,21 +50,26 @@
 
 
 void ViewItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) {
-  QPainter p(widget);
-  p.setPen(Qt::DotLine);
+  QRectF realBound = mapToScene(boundingRect()).boundingRect();
 
-  QRectF bound = parentView()->mapFromScene(mapToScene(boundingRect())).boundingRect();
-  p.drawRect(bound);
+  painter->save();
+  painter->setPen(Qt::DotLine);
+  painter->setTransform(parentView()->viewportTransform());
+  if (isSelected())
+    painter->drawRect(realBound);
 
 #ifdef DEBUG_GEOMETRY
   QColor semiRed(QColor(255, 0, 0, 50));
-  p.fillRect(bound, semiRed);
+  painter->fillRect(realBound, semiRed);
 #endif
-  p.end();
 
-//   painter->restore();
+  painter->restore();
 
-  QGraphicsRectItem::paint(painter, option, widget);
+  painter->setPen(pen());
+  painter->setBrush(brush());
+  painter->drawRect(rect());
+
+//   QGraphicsRectItem::paint(painter, option, widget);
 }
 
 
--- branches/work/kst/portto4/kst/src/libkstapp/viewitem.h #673334:673335
@@ -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