[Kst] kdeextragear-2/kst/kst

Andrew Walker arwalker at sumusltd.com
Fri Jun 4 20:59:44 CEST 2004


CVS commit by arwalker: 

When aligning objects make sure they all remain fully within the window, to be consistent with the inability to move a plot even partially outside a window.


  M +21 -5     ksttoplevelview.cpp   1.52
  M +1 -0      ksttoplevelview.h   1.29


--- kdeextragear-2/kst/kst/ksttoplevelview.cpp  #1.51:1.52
@@ -500,4 +500,6 @@ void KstTopLevelView::pressMove(const QP
 
 void KstTopLevelView::releaseShiftPress(const QPoint& pos) {
+  Q_UNUSED(pos)
+
   if (_mode != LayoutMode) {
     _pressTarget = 0L;
@@ -693,4 +696,17 @@ void KstTopLevelView::makeSameSize() {
 
 
+void KstTopLevelView::checkPosition( KstViewObjectPtr pObject, QPoint point ) {
+  QRect rect;
+
+  rect = pObject->geometry();
+  rect.moveTopLeft(point);
+  if (!_geom.contains(rect, true)) {
+    slideInto(_geom, rect);
+    point = rect.topLeft();
+  }
+  pObject->move(point);
+}
+
+
 void KstTopLevelView::alignLeft() {
   QRect gg;
@@ -701,6 +717,6 @@ void KstTopLevelView::alignLeft() {
     point.setX( gg.x() );
     for (KstViewObjectList::Iterator i = _selectionList.begin(); i != _selectionList.end(); ++i) {
-      point.setY( (*i)->geometry().y() );
-      (*i)->move(point);
+      point.setY((*i)->geometry().y());
+      checkPosition(*i, point);
     }
   }
@@ -718,5 +734,5 @@ void KstTopLevelView::alignRight() {
       point.setX( gg.x() + gg.width() - (*i)->geometry().width() );
       point.setY( (*i)->geometry().y() );
-      (*i)->move(point);
+      checkPosition(*i, point);
     }
   }
@@ -734,5 +750,5 @@ void KstTopLevelView::alignTop() {
     for (KstViewObjectList::Iterator i = _selectionList.begin(); i != _selectionList.end(); ++i) {
       point.setX( (*i)->geometry().x() );
-      (*i)->move(point);
+      checkPosition(*i, point);
     }
   }
@@ -750,5 +766,5 @@ void KstTopLevelView::alignBottom() {
       point.setX( (*i)->geometry().x() );
       point.setY( gg.y() + gg.height() - (*i)->geometry().height() );
-      (*i)->move(point);
+      checkPosition(*i, point);
     }
   }

--- kdeextragear-2/kst/kst/ksttoplevelview.h  #1.28:1.29
@@ -93,4 +93,5 @@ class KstTopLevelView : public KstViewOb
     void setCursorFor(const QPoint& pos, const QRect& objGeom);
     bool popupMenu(KPopupMenu *menu, const QPoint& pos);
+    void checkPosition( KstViewObjectPtr pObject, QPoint point );
 
     // Called as a response to drag re-entering widget()





More information about the Kst mailing list