[PyKDE] QDropEvent.action() bug?

Torsten Marek shlomme at gmx.net
Wed Jul 23 18:11:01 BST 2003


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

-- 
Torsten Marek <shlomme at gmx.net>
ID: A244C858 -- fingerprint 1902 0002 5DFC 856B F146  894C 7CC5 451E 
A244 C858
www.keyserver.net -- wwwkeys.eu.pgp.net

< information must flow >


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 252 bytes
Desc: not available
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20030723/f355c13b/attachment.bin


More information about the PyQt mailing list