[Kst] kdeextragear-2/kst/kst

George Staikos staikos at kde.org
Wed Apr 28 22:41:13 CEST 2004


CVS commit by staikos: 

1) revert last - I put all that code in for a reason.  I want to be able to
   cancel drag when the user returns to the source.  I just haven't found
   the right hack to make it work yet.  Without this behaviour, the user
   gets extremely frustrated when he moves a small object close to a border.
2) modifiers must not affect object-moves-in-progress, slowly fixing again


  M +16 -24    kstviewwidget.cpp   1.21


--- kdeextragear-2/kst/kst/kstviewwidget.cpp  #1.20:1.21
@@ -92,5 +92,5 @@ void KstViewWidget::mouseMoveEvent(QMous
     _view->updateFocus(e->pos());
     e->accept();
-  } else if (!(e->state() & Qt::ShiftButton) && (e->state() & Qt::LeftButton)) {
+  } else if (e->state() & Qt::LeftButton) {
     _view->pressMove(e->pos());
     e->accept();
@@ -124,5 +124,5 @@ void KstViewWidget::mousePressEvent(QMou
 void KstViewWidget::mouseReleaseEvent(QMouseEvent *e) {
   //kdDebug() << "Release event. button=" << e->button() << " state=" << e->state() << endl;
-  if((e->state() & Qt::ShiftButton) && (e->button() & Qt::LeftButton)) {
+  if((e->state() & Qt::ShiftButton) && (e->button() & Qt::LeftButton) && !_view->tracking()) {
     _view->releaseShiftPress(e->pos());
   } else if (e->button() & Qt::LeftButton) {
@@ -174,5 +174,8 @@ void KstViewWidget::dragEnterEvent(QDrag
   if (e->provides(KstPlotDrag::mimeType())) {
     if (e->source() == this) {
-      e->ignore();
+      delete _drag;
+      _drag = 0L;
+      _view->restartMove();
+      e->accept(false);
     } else {
       e->acceptAction(true);
@@ -186,13 +189,6 @@ void KstViewWidget::dragEnterEvent(QDrag
 void KstViewWidget::dragMoveEvent(QDragMoveEvent *e) {
   if (!_dragEnabled) {
-    e->ignore();
-  } else {
-    if (e->provides(KstPlotDrag::mimeType())) {
-      if (e->source() == this) {
-        e->ignore();
+    e->accept(false);
       } else {
-        e->acceptAction(true);
-      }
-    }
     // e->accept(true);  FIXME: check mimetype etc
     QWidget::dragMoveEvent(e);
@@ -208,6 +204,5 @@ void KstViewWidget::dragLeaveEvent(QDrag
 
 void KstViewWidget::dropEvent(QDropEvent *e) {
-  if(e->provides(KstPlotDrag::mimeType())) {
-    if (e->source() != this) {
+  if (e->source() != this && e->provides(KstPlotDrag::mimeType())) {
       // FIXME: support both copy and move
       QByteArray a = e->encodedData(KstPlotDrag::mimeType());
@@ -220,7 +215,4 @@ void KstViewWidget::dropEvent(QDropEvent
       _view->paint();
     } else {
-      e->ignore();
-    }
-  } else {
     QWidget::dropEvent(e);
   }





More information about the Kst mailing list