2
from PySide.QtCore import *
3
from PySide.QtGui import *
5
class MyItemModel(QStandardItemModel):
6
def __init__(self,parent=None):
7
super(MyItemModel,self).__init__(parent)
8
self.appendRow([QStandardItem('Item 1'),])
11
mtypes = super(MyItemModel,self).mimeTypes()
12
mtypes.append(u'application/my-form')
15
def mimeData(self,indexes):
16
self.__mimedata = super(MyItemModel,self).mimeData(indexes)
17
self.__mimedata.setData(u'application/my-form', 'hi')
18
return self.__mimedata
20
class TestBug660(unittest.TestCase):
21
'''QMimeData type deleted prematurely when overriding mime-type in QStandardItemModel drag and drop'''
24
model.mimeData([model.index(0, 0)]) # if it doesn't raise an exception it's all right!
26
if __name__ == '__main__':