From 0f0124e54c22d46fa71722b9eff93ebb34816d4c Mon Sep 17 00:00:00 2001 From: Hugo Parente Lima Date: Wed, 20 Apr 2011 16:36:27 -0300 Subject: Fix bug 768 - "Method "QGraphicsItemGroup* QGraphicsScene::createItemGroup(const QList& items)" missing" Fix bug 769 - "Method "QGraphicsScene::destroyItemGroup(QGraphicsItemGroup* group)" missing" Reviewer: Marcelo Lira --- PySide/QtGui/typesystem_gui_common.xml | 26 ++++++++++++++++++++++---- tests/QtGui/qgraphicsscene_test.py | 16 ++++++++++++++++ 2 files changed, 38 insertions(+), 4 deletions(-) diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml index bbb4b0cf7..da919e870 100644 --- a/PySide/QtGui/typesystem_gui_common.xml +++ b/PySide/QtGui/typesystem_gui_common.xml @@ -3210,12 +3210,30 @@ - - - - + + + + + + + + + + + + Shiboken::AutoDecRef parent(%CONVERTTOPYTHON[QGraphicsItem*](%1->parentObject())); + foreach (QGraphicsItem* item, %1->children()) + Shiboken::Object::setParent(parent, %CONVERTTOPYTHON[QGraphicsItem*](item)); + %BEGIN_ALLOW_THREADS + %CPPSELF.%FUNCTION_NAME(%1); + %END_ALLOW_THREADS + // the arg was destroyed by Qt. + Shiboken::Object::invalidate(%PYARG_1); + + + diff --git a/tests/QtGui/qgraphicsscene_test.py b/tests/QtGui/qgraphicsscene_test.py index 98177e75a..85f5004c6 100644 --- a/tests/QtGui/qgraphicsscene_test.py +++ b/tests/QtGui/qgraphicsscene_test.py @@ -148,5 +148,21 @@ class ItemRetrieve(UsesQApplication): self.assertEqual(self.scene.itemAt(50, 150), self.bottomleft) self.assertEqual(self.scene.itemAt(150, 150), self.bottomright) +class TestGraphicsGroup(UsesQApplication): + def testIt(self): + scene = QGraphicsScene() + i1 = QGraphicsRectItem() + scene.addItem(i1) + i2 = QGraphicsRectItem(i1) + i3 = QGraphicsRectItem() + i4 = QGraphicsRectItem() + group = scene.createItemGroup((i2, i3, i4)) + scene.removeItem(i1) + del i1 # this shouldn't delete i2 + self.assertEqual(i2.scene(), scene) + scene.destroyItemGroup(group) + self.assertRaises(RuntimeError, group.type) + + if __name__ == '__main__': unittest.main() -- cgit v1.2.3