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

Barth Netterfield netterfield at astro.utoronto.ca
Fri Oct 22 03:38:35 CEST 2010


SVN commit 1188329 by netterfield:

BUG: 253165

Drop events are handled by the scene, which works in scene coordinates.  This was confusing the
GraphicsItems which work in their parent's coordinates.  Hence, meyhem.

This fix just converts the drop event back into parental coordinates in the viewitem.

I think this changed when d&d was being implemented to fix 258885.



 M  +8 -2      viewitem.cpp  


--- branches/work/kst/portto4/kst/src/libkstapp/viewitem.cpp #1188328:1188329
@@ -1799,7 +1799,14 @@
 
 void ViewItem::moveTo(const QPointF& pos)
 {
-  setPos(view()->snapPoint(pos));
+
+  QPointF newpos = view()->snapPoint(pos);
+
+  if (parentViewItem()) {
+    newpos -= parentViewItem()->scenePos();
+  }
+
+  setPos(newpos);
   new MoveCommand(this, _originalPosition, pos);
   updateViewItemParent();
   updateRelativeSize();
@@ -1819,7 +1826,6 @@
 #endif
   } else if (oldMode == View::Resize && _originalRect != rect()) {
     new ResizeCommand(this, _originalRect, rect());
-
     updateViewItemParent();
   } else if (oldMode == View::Scale && _originalTransform != transform()) {
     new ScaleCommand(this, _originalTransform, transform());


More information about the Kst mailing list