Bug 127042 - Drag in view object manager has problems
Summary: Drag in view object manager has problems
Status: RESOLVED FIXED
Alias: None
Product: kst
Classification: Applications
Component: general (show other bugs)
Version: 1.x
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: kst
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-05-09 21:07 UTC by Netterfield
Modified: 2006-05-11 00:15 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Netterfield 2006-05-09 21:07:36 UTC
Version:           1.3.0_devel (using KDE 3.5.1 Level "a" , SUSE 10.0 UNSUPPORTED)
Compiler:          Target: i586-suse-linux
OS:                Linux (i686) release 2.6.13-15.8-default

create a plot with several plots, each with curves.
Put a viewlabel in one of the plots
open the view object dialog.

I)
In the view object dialog drag a curve, and drop it on top of a curve in another plot.  Nothing happens.
There is no indication that thing is going to happen.

A sensible behavior is for the curve to be added to the plot.  A different sensible behavior is for the mouse to indicate that a drop is not possible when over the curve.

II)
In the view object dialog, drag the label.  Again there is no indication whether a drag will do anything or not.  

III) 
In the view object dialog, drag the label and drag it on a plot.  The view object gets dropped parented by the window, not by the plot.  It should be parented by the plot.
Comment 1 Andrew Walker 2006-05-09 23:08:05 UTC
I) by view object dialog do you mean view manager?
If so this is a bug with the QListView that does not
set the appropriate cursor even when it is told that
the drop should not be allowed.

II) ditto

III) agreed
Comment 2 Netterfield 2006-05-10 00:02:43 UTC
OK, then, for (I) and (II), when you dump on top of a descendent of an object which could accept the curve, then add it to the ancestor which could accept it. (ie, if you dump a curve or a label on a curve, add it to the plot curve's parent plot).
Comment 3 Andrew Walker 2006-05-10 02:11:12 UTC
SVN commit 539226 by arwalker:

CCBUG:127042 Fix I and II by applying a hack to work around the bug in QListView

 M  +7 -1      kstviewmanager_i.cpp  
 M  +4 -4      kstviewmanager_i.h  


--- trunk/extragear/graphics/kst/src/libkstapp/kstviewmanager_i.cpp #539225:539226
@@ -172,6 +172,12 @@
     }
   }
   
+  if (retVal) {
+    _vm->ViewView->viewport()->setCursor(Qt::ArrowCursor);
+  } else {
+    _vm->ViewView->viewport()->setCursor(Qt::ForbiddenCursor);  
+  }
+  
   return retVal;
 }
 
@@ -375,7 +381,7 @@
   ViewView->setAllColumnsShowFocus(TRUE);
   ViewView->setShowSortIndicator(TRUE);
   ViewView->setRootIsDecorated(TRUE);
-  ViewView->setAcceptDrops(TRUE);
+  ViewView->setAcceptDrops(FALSE);
   ViewView->viewport()->setAcceptDrops(TRUE);
   ViewView->setSelectionMode(QListView::Single);
   KstViewManagerLayout->addMultiCellWidget(ViewView, 0, 0, 0, 3);
--- trunk/extragear/graphics/kst/src/libkstapp/kstviewmanager_i.h #539225:539226
@@ -41,8 +41,8 @@
     KstViewObjectItem(QListViewItem *parent, KstBaseCurvePtr x, KstViewManagerI *dm, int localUseCount = 0);
     virtual ~KstViewObjectItem();
 
-    bool acceptDrop(const QMimeSource *mime) const;
-    void dropped(QDropEvent *e);
+    virtual bool acceptDrop(const QMimeSource *mime) const;
+    virtual void dropped(QDropEvent *e);
     virtual int rtti() const { return _rtti; }
 
     void update(KstViewObjectPtr x, bool recursive = true, int localUseCount = 0);
@@ -82,8 +82,8 @@
     void open();
     void close();
     void openAll();
-    void closeAll();
-
+    void closeAll();   
+  
   private slots:
     void doUpdates();
     void contextMenu(QListViewItem *i, const QPoint& p, int c);
Comment 4 Andrew Walker 2006-05-10 02:48:54 UTC
SVN commit 539229 by arwalker:

CCBUG:127042 Still not perfect but better than before

 M  +9 -1      kstviewmanager_i.cpp  
 M  +1 -0      kstviewmanager_i.h  


--- trunk/extragear/graphics/kst/src/libkstapp/kstviewmanager_i.cpp #539228:539229
@@ -100,6 +100,12 @@
   return drag;
 }
 
+void KstViewListView::contentsMouseMoveEvent(QMouseEvent *e) {
+  viewport()->setCursor(Qt::ArrowCursor);
+  
+  QListView::contentsMouseMoveEvent(e);
+}
+
 // ==============================================
 
 KstViewObjectItem::KstViewObjectItem(QListView *parent, KstTopLevelViewPtr x, KstViewManagerI *vm, int localUseCount)
@@ -147,7 +153,6 @@
 KstViewObjectItem::~KstViewObjectItem() {
 }
 
-
 bool KstViewObjectItem::acceptDrop(const QMimeSource *mime) const {
   bool retVal = false;
 
@@ -172,6 +177,9 @@
     }
   }
   
+  //
+  // the following should not be necessary but is due to a bug in QListView...
+  //
   if (retVal) {
     _vm->ViewView->viewport()->setCursor(Qt::ArrowCursor);
   } else {
--- trunk/extragear/graphics/kst/src/libkstapp/kstviewmanager_i.h #539228:539229
@@ -32,6 +32,7 @@
    
   protected:
     virtual QDragObject* dragObject();
+    virtual void contentsMouseMoveEvent(QMouseEvent *e);
 };
 
 class KstViewObjectItem : public QListViewItem {
Comment 5 Andrew Walker 2006-05-11 00:15:32 UTC
SVN commit 539545 by arwalker:

BUG:127042 Allow the user to drag and drop view object to any other view object from the view manager

 M  +1 -51     kst.cpp  
 M  +0 -2      kst.h  
 M  +5 -2      kst2dplot.cpp  
 M  +1 -1      kst2dplot.h  
 M  +5 -2      kstplotgroup.cpp  
 M  +1 -1      kstplotgroup.h  
 M  +10 -2     kstviewarrow.cpp  
 M  +3 -1      kstviewarrow.h  
 M  +5 -2      kstviewbox.cpp  
 M  +1 -1      kstviewbox.h  
 M  +5 -2      kstviewellipse.cpp  
 M  +1 -1      kstviewellipse.h  
 M  +5 -2      kstviewlabel.cpp  
 M  +1 -1      kstviewlabel.h  
 M  +5 -2      kstviewlegend.cpp  
 M  +1 -1      kstviewlegend.h  
 M  +5 -2      kstviewline.cpp  
 M  +1 -1      kstviewline.h  
 M  +29 -14    kstviewmanager_i.cpp  
 M  +65 -1     kstviewobject.cpp  
 M  +5 -2      kstviewobject.h  
 M  +5 -2      kstviewpicture.cpp  
 M  +1 -1      kstviewpicture.h  
 M  +14 -4     kstviewwidget.cpp