[PyKDE] QDropEvent.action() bug?

Phil Thompson phil at riverbankcomputing.co.uk
Thu Jul 24 17:09:00 BST 2003


There does seem to be a SIP bug because you shouldn't be able to create an 
instance of QDragObject as it's abstract. However this has nothing to do with 
your problem.

The equivalent C++ code behaves in the same way (using QTextDrag instead of 
QDragObject), so that implies it is an error in your script.

Phil

On Wednesday 23 July 2003 5:11 pm, Torsten Marek wrote:
> Hi there,
>
> I encountered the problem that QDropEvent.action() always returns 0,
> regardless what the drag op was started with or how. I'm using Qt 3.1.2
> and PyQt 3.7 and it can't be a bug of Qt because in the Qt example
> FileIconView, the application is able to distinguish between copy and
> move event.
> I added a small sample application demonstrating the problem (the
> messagebox saying "the item has been copied" keeps popping up)
>
> --- snip here ---
> from qt import *
>
> class TestListView(QListView):
>      def __init__(self, *args):
>          apply(QListView.__init__, (self,)+args)
>          self.setAcceptDrops(True)
>          self.viewport().setAcceptDrops(True)
>          self.addColumn("first column")
>          for i in range(1,10):
>              item = QListViewItem(self, "item %i" % i)
>              item.setDragEnabled(True)
>              item.setDropEnabled(True)
>
>
>      def dragObject(self):
>          return QDragObject(self)
>
>      def contentsDropEvent(self, e):
>          if e.action() == QDropEvent.Move:
>              QMessageBox.information(self, "info", "Item has been moved")
>          elif e.action() == QDropEvent.Copy:
>              QMessageBox.information(self, "info", "Item has been copied")
>
> a = QApplication([''])
> mw = TestListView()
> a.setMainWidget(mw)
> mw.show()
> a.exec_loop()
> --- snip here ---
>
> greetings
>
> Torsten




More information about the PyQt mailing list