views:

47

answers:

1

I'm trying to create a custom QTableView that will respond to drag and drop actions. So far, I have something like the following:

from PyQt4.QtCore import *
from PyQt4.QtGui import *

class FooTableView(QTableView):

    def __init__(self, parent = None):
        QTableView.__init__(self, parent)
        self.setAcceptDrops(True)

    def dragEnterEvent(self, event):
        print "dragged!"

    def dropEvent(self, event):
        print "dropped!"

The problem is that when I drag a file into this view, I see "dragged!" but upon releasing the file over the view, I do not see "dropped!". Is there something else I need to do in order to make this functionality work?

A: 

Ok, I think I figured it out. The event must be accepted in dragEnterEvent in order for it to make it to dropEvent.

Paul Wicks