summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.pl@gmail.com>2011-02-04 17:42:38 -0200
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:53:54 -0300
commit59c882566be0d58c256f715ce675f10f3181ccc3 (patch)
tree68a16a0910f13785aae35f75f6305ed4edb33640
parent34529760f4766a84a7dbb8f32c776abfe9c4fdda (diff)
Fix bug 660 - "QMimeData type deleted prematurely when overriding mime-type in QStandardItemModel drag and drop"
-rw-r--r--PySide/QtCore/typesystem_core.xml3
-rw-r--r--tests/QtGui/CMakeLists.txt1
-rw-r--r--tests/QtGui/bug_660.py27
3 files changed, 30 insertions, 1 deletions
diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml
index 51019778..8e292cf1 100644
--- a/PySide/QtCore/typesystem_core.xml
+++ b/PySide/QtCore/typesystem_core.xml
@@ -1129,7 +1129,8 @@
</add-function>
<modify-function signature="mimeData(QList&lt;QModelIndex&gt;) const">
<modify-argument index="return">
- <define-ownership owner="c++"/>
+ <define-ownership class="native" owner="c++"/>
+ <define-ownership class="target" owner="default"/>
</modify-argument>
</modify-function>
<modify-function signature="data(const QModelIndex&amp;,int) const">
diff --git a/tests/QtGui/CMakeLists.txt b/tests/QtGui/CMakeLists.txt
index 83af1e61..d4e91410 100644
--- a/tests/QtGui/CMakeLists.txt
+++ b/tests/QtGui/CMakeLists.txt
@@ -34,6 +34,7 @@ PYSIDE_TEST(bug_617.py)
PYSIDE_TEST(bug_640.py)
PYSIDE_TEST(bug_652.py)
PYSIDE_TEST(bug_653.py)
+PYSIDE_TEST(bug_660.py)
PYSIDE_TEST(customproxywidget_test.py)
PYSIDE_TEST(deepcopy_test.py)
PYSIDE_TEST(float_to_int_implicit_conversion_test.py)
diff --git a/tests/QtGui/bug_660.py b/tests/QtGui/bug_660.py
new file mode 100644
index 00000000..f001d36f
--- /dev/null
+++ b/tests/QtGui/bug_660.py
@@ -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()