diff options
-rw-r--r-- | PySide/QtCore/typesystem_core.xml | 3 | ||||
-rw-r--r-- | tests/QtGui/CMakeLists.txt | 1 | ||||
-rw-r--r-- | tests/QtGui/bug_660.py | 27 |
3 files changed, 30 insertions, 1 deletions
diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml index 51019778c..8e292cf18 100644 --- a/PySide/QtCore/typesystem_core.xml +++ b/PySide/QtCore/typesystem_core.xml @@ -1129,7 +1129,8 @@ </add-function> <modify-function signature="mimeData(QList<QModelIndex>) 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&,int) const"> diff --git a/tests/QtGui/CMakeLists.txt b/tests/QtGui/CMakeLists.txt index 83af1e610..d4e914107 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 000000000..f001d36f2 --- /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() |