Fix bug 660 - "QMimeData type deleted prematurely when overriding mime-type in QStandardItemModel drag and drop"
This commit is contained in:
parent
34529760f4
commit
59c882566b
3 changed files with 30 additions and 1 deletions
|
|
@ -1129,7 +1129,8 @@
|
||||||
</add-function>
|
</add-function>
|
||||||
<modify-function signature="mimeData(QList<QModelIndex>) const">
|
<modify-function signature="mimeData(QList<QModelIndex>) const">
|
||||||
<modify-argument index="return">
|
<modify-argument index="return">
|
||||||
<define-ownership owner="c++"/>
|
<define-ownership class="native" owner="c++"/>
|
||||||
|
<define-ownership class="target" owner="default"/>
|
||||||
</modify-argument>
|
</modify-argument>
|
||||||
</modify-function>
|
</modify-function>
|
||||||
<modify-function signature="data(const QModelIndex&,int) const">
|
<modify-function signature="data(const QModelIndex&,int) const">
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@ PYSIDE_TEST(bug_617.py)
|
||||||
PYSIDE_TEST(bug_640.py)
|
PYSIDE_TEST(bug_640.py)
|
||||||
PYSIDE_TEST(bug_652.py)
|
PYSIDE_TEST(bug_652.py)
|
||||||
PYSIDE_TEST(bug_653.py)
|
PYSIDE_TEST(bug_653.py)
|
||||||
|
PYSIDE_TEST(bug_660.py)
|
||||||
PYSIDE_TEST(customproxywidget_test.py)
|
PYSIDE_TEST(customproxywidget_test.py)
|
||||||
PYSIDE_TEST(deepcopy_test.py)
|
PYSIDE_TEST(deepcopy_test.py)
|
||||||
PYSIDE_TEST(float_to_int_implicit_conversion_test.py)
|
PYSIDE_TEST(float_to_int_implicit_conversion_test.py)
|
||||||
|
|
|
||||||
27
tests/QtGui/bug_660.py
Normal file
27
tests/QtGui/bug_660.py
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
import unittest
|
||||||
|
from PySide.QtCore import *
|
||||||
|
from PySide.QtGui import *
|
||||||
|
|
||||||
|
class MyItemModel(QStandardItemModel):
|
||||||
|
def __init__(self,parent=None):
|
||||||
|
super(MyItemModel,self).__init__(parent)
|
||||||
|
self.appendRow([QStandardItem('Item 1'),])
|
||||||
|
|
||||||
|
def mimeTypes(self):
|
||||||
|
mtypes = super(MyItemModel,self).mimeTypes()
|
||||||
|
mtypes.append(u'application/my-form')
|
||||||
|
return mtypes
|
||||||
|
|
||||||
|
def mimeData(self,indexes):
|
||||||
|
self.__mimedata = super(MyItemModel,self).mimeData(indexes)
|
||||||
|
self.__mimedata.setData(u'application/my-form', 'hi')
|
||||||
|
return self.__mimedata
|
||||||
|
|
||||||
|
class TestBug660(unittest.TestCase):
|
||||||
|
'''QMimeData type deleted prematurely when overriding mime-type in QStandardItemModel drag and drop'''
|
||||||
|
def testIt(self):
|
||||||
|
model = MyItemModel()
|
||||||
|
model.mimeData([model.index(0, 0)]) # if it doesn't raise an exception it's all right!
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
||||||
Loading…
Add table
Add a link
Reference in a new issue