[Kst] extragear/graphics/kst/kst

George Staikos staikos at kde.org
Tue Dec 6 06:37:57 CET 2005


SVN commit 485917 by staikos:

It's a bit buggy still, but dragging all view objects to other applications
that accept as an image works now.  Also includes a focus change that finds
the deepest child instead of the first one for mouse handling.  This will be
used for embedded object support.

The images produced by this are close, but still not quite right.  Plots are
the right size but in the wrong location.  Other objects are the wrong size and
in the wrong location.  The image size is correct.


 M  +1 -1      Makefile.am  
 D             kstplotimagedrag.cpp  
 D             kstplotimagedrag.h  
 A             kstviewobjectimagedrag.cpp   kstplotimagedrag.cpp#485530 [License: GPL (v2+)]
 A             kstviewobjectimagedrag.h   kstplotimagedrag.h#485530 [License: GPL (v2+)]
 M  +20 -31    kstviewwidget.cpp  


--- trunk/extragear/graphics/kst/kst/Makefile.am #485916:485917
@@ -147,7 +147,7 @@
 	statuslabel.cpp \
 	plotmimesource.cpp \
 	kstplotdrag.cpp \
-	kstplotimagedrag.cpp \
+	kstviewobjectimagedrag.cpp \
 	kstscalartable.cpp \
 	kstvectortable.cpp \
 	kstmatrixtable.cpp \
--- trunk/extragear/graphics/kst/kst/kstviewwidget.cpp #485916:485917
@@ -21,7 +21,7 @@
 #include <kmultipledrag.h>
 
 #include "kst.h"
-#include "kstplotimagedrag.h"
+#include "kstviewobjectimagedrag.h"
 #include "ksttimers.h"
 #include "kstviewwidget.h"
 #include "kstviewwindow.h"
@@ -46,13 +46,11 @@
 
 QDragObject *KstViewWidget::dragObject() {
   KMultipleDrag *drag = new KMultipleDrag(this);
-  QString window;
+#if 1
   QStringList plots;
   KstViewObjectList vol;
-  
-#if 1
-  window = static_cast<KstViewWindow*>(parent())->caption();
-  
+  QString window = static_cast<KstViewWindow*>(parent())->caption();
+
   if (_view->selectionList().isEmpty()) {
     if (_view->pressTarget()) {
       plots.append(_view->pressTarget()->tagName());
@@ -71,8 +69,8 @@
   }
 
   drag->addDragObject(new PlotMimeSource(window, plots, 0L));
-  KstPlotImageDrag *imd = new KstPlotImageDrag(this);
-  imd->setPlots(vol);
+  KstViewObjectImageDrag *imd = new KstViewObjectImageDrag(this);
+  imd->setObjects(vol);
   drag->addDragObject(imd);
 #else
   drag->addDragObject(new KstPlotDrag(...));
@@ -129,22 +127,13 @@
 }
 
 
-// FIXME: this is probably wrong in that we probably want the inner-most child
-//        that handles mouse events on this position, not the outer-most.
-//        However, this is not a problem right now since we only have working
-//        objects at one level deep.
 KstViewObjectPtr KstViewWidget::findChildFor(const QPoint& pos) {
   KstViewObjectPtr rc, search = _view.data();
 
-  while (!rc.data()) {
-    rc = search->findChild(pos);
-    if (rc) {
-      if (!rc->mouseHandler()) {
-        search = rc;
-        rc = 0L;
-      }
-    } else {
-      break;
+  while (search) {
+    search = search->findChild(pos);
+    if (search && search->mouseHandler()) {
+      rc = search;
     }
   }
   return rc;
@@ -177,7 +166,7 @@
     } else {
       setCursor(QCursor(Qt::ArrowCursor));
     }
-  } else { 
+  } else {
     if ((e->state() & Qt::MouseButtonMask) == 0) {
       switch (_view->viewMode()) {
         case KstTopLevelView::LabelMode:
@@ -256,21 +245,21 @@
     }
     return;
   }
- 
-  // layout/graphics mode 
+
+  // layout/graphics mode
   if (e->button() & Qt::LeftButton) {
     // let the toplevel view handle it
     if (_view->handleDoubleClick(e->pos(), e->state() & Qt::ShiftButton)) {
       e->accept();
-      return;  
-    }  
+      return;
+    }
   }
 
   //kstdDebug() << "   -> Passing up" << endl;
   QWidget::mouseDoubleClickEvent(e);
 }
 
- 
+
 void KstViewWidget::wheelEvent(QWheelEvent *e) {
   if (_view->viewMode() == KstTopLevelView::DisplayMode) {
     KstViewObjectPtr vo;
@@ -477,12 +466,12 @@
       paint();
       return;
     } else if (e->key() == Qt::Key_Delete) {
-      _view->deleteSelectedObjects(); 
-      return; 
+      _view->deleteSelectedObjects();
+      return;
     } else if (e->key() == Qt::Key_Control && (_view->viewMode() != KstTopLevelView::LayoutMode)) {
       _lastViewMode = _view->viewMode();
       _view->setViewMode(KstTopLevelView::LayoutMode);
-      return;  
+      return;
     }
   }
 
@@ -504,7 +493,7 @@
     }
     return;
   } else if (e->key() == Qt::Key_Control && _view->viewMode() == KstTopLevelView::LayoutMode) {
-    _view->setViewMode(_lastViewMode);  
+    _view->setViewMode(_lastViewMode);
     _lastViewMode = KstTopLevelView::LayoutMode;
   }
 


More information about the Kst mailing list