M
Mudcat
I'm trying to drag/drop info from a TreeWidget into a TextBox. I have
been able to modify the TextEdit box to override the dragEnterEvent
like this:
class TextEdit(QtGui.QTextEdit):
def __init__(self, title, parent):
QtGui.QTextEdit.__init__(self, title, parent)
self.setAcceptDrops(True)
def dragEnterEvent(self, event):
if event.mimeData().hasFormat('text/plain'):
event.accept()
elif (event.mimeData().hasFormat("application/x-
qabstractitemmodeldatalist")):
print event
itemData = event.mimeData().retrieveData("application/x-
qabstractitemmodeldatalist", QtCore.QVariant.List)
The drag is working up until the point I try to actually retrieve the
data. At that point I get an unhandled Runtime Error saying "no access
to protected functions or signals for objects not created in Python".
Obviously I am not retrieving them in the correct format. Does anyone
know how to convert/retrieve the information into a Python list?
Thanks
been able to modify the TextEdit box to override the dragEnterEvent
like this:
class TextEdit(QtGui.QTextEdit):
def __init__(self, title, parent):
QtGui.QTextEdit.__init__(self, title, parent)
self.setAcceptDrops(True)
def dragEnterEvent(self, event):
if event.mimeData().hasFormat('text/plain'):
event.accept()
elif (event.mimeData().hasFormat("application/x-
qabstractitemmodeldatalist")):
print event
itemData = event.mimeData().retrieveData("application/x-
qabstractitemmodeldatalist", QtCore.QVariant.List)
The drag is working up until the point I try to actually retrieve the
data. At that point I get an unhandled Runtime Error saying "no access
to protected functions or signals for objects not created in Python".
Obviously I am not retrieving them in the correct format. Does anyone
know how to convert/retrieve the information into a Python list?
Thanks