[Kst] kdeextragear-2/kst/kst

George Staikos staikos at kde.org
Tue Apr 6 21:20:17 CEST 2004


CVS commit by staikos: 

those coordinate calculations were wrong for top-left


  M +30 -11    ksttoplevelview.cpp   1.12
  M +0 -2      kstviewobject.cpp   1.12


--- kdeextragear-2/kst/kst/kstviewobject.cpp  #1.11:1.12
@@ -254,5 +254,4 @@ void KstViewObject::recursively(void (Ks
 
 KstViewObjectPtr KstViewObject::findChild(const QPoint& pos) {
-  kdDebug() << "Searching for child at " << pos << endl;
   if (!QRect(_pos, _size).contains(pos)) {
     return KstViewObjectPtr();
@@ -260,5 +259,4 @@ KstViewObjectPtr KstViewObject::findChil
 
   for (KstViewObjectList::Iterator i = _children.begin(); i != _children.end(); ++i) {
-    kdDebug() << " ->Comparing against " << (*i)->position() << endl;
     if (QRect((*i)->position(), (*i)->size()).contains(pos)) {
       return *i;

--- kdeextragear-2/kst/kst/ksttoplevelview.cpp  #1.11:1.12
@@ -211,5 +211,4 @@ bool KstTopLevelView::handlePress(const 
   // FIXME: draw the size rect
  
-  kdDebug() << " -> OK" << endl;
   return true;
 }
@@ -228,37 +227,57 @@ void KstTopLevelView::releasePress(const
   if (_pressTarget) {
     QRect g = _pressTarget->geometry();
+    QPoint save;
     switch (_pressDirection) {
       case UP:
-        g.setTop(pos.y());
+        save = g.bottomRight();
+        g.moveTop(pos.y());
+        g.setBottomRight(save);
         _pressTarget->move(g.topLeft());
+        _pressTarget->resize(g.size());
         break;
       case DOWN:
-        g.setBottom(pos.y());
+        save = g.topLeft();
+        g.moveBottom(pos.y());
+        g.setTopLeft(save);
         _pressTarget->resize(g.size());
         break;
       case LEFT:
-        g.setLeft(pos.x());
+        save = g.bottomRight();
+        g.moveLeft(pos.x());
+        g.setBottomRight(save);
         _pressTarget->move(g.topLeft());
+        _pressTarget->resize(g.size());
         break;
       case RIGHT:
-        g.setRight(pos.x());
+        save = g.topLeft();
+        g.moveRight(pos.x());
+        g.setTopLeft(save);
         _pressTarget->resize(g.size());
         break;
       case UP|LEFT:
-        _pressTarget->move(pos);
+        save = g.bottomRight();
+        g.moveTopLeft(pos);
+        g.setBottomRight(save);
+        _pressTarget->move(g.topLeft());
+        _pressTarget->resize(g.size());
         break;
       case DOWN|RIGHT:
-        g.setBottomRight(pos);
+        save = g.topLeft();
+        g.moveBottomRight(pos);
+        g.setTopLeft(save);
+        _pressTarget->move(g.topLeft());
         _pressTarget->resize(g.size());
         break;
       case UP|RIGHT:
-        g.setTop(pos.y());
-        g.setRight(pos.x());
+        save = g.bottomLeft();
+        g.moveTopRight(pos);
+        g.setBottomLeft(save);
         _pressTarget->move(g.topLeft());
         _pressTarget->resize(g.size());
         break;
       case DOWN|LEFT:
-        g.setBottom(pos.y());
-        g.setLeft(pos.x());
+        save = g.topRight();
+        g.moveBottomLeft(pos);
+        g.setTopRight(save);
         _pressTarget->move(g.topLeft());
         _pressTarget->resize(g.size());





More information about the Kst mailing list