diff options
-rw-r--r-- | PySide/QtCore/typesystem_core.xml | 88 | ||||
-rw-r--r-- | tests/QtCore/qrect_test.py | 12 |
2 files changed, 95 insertions, 5 deletions
diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml index a30e50e..507e55a 100644 --- a/PySide/QtCore/typesystem_core.xml +++ b/PySide/QtCore/typesystem_core.xml @@ -862,10 +862,48 @@ }; </inject-code> <modify-function signature="getCoords(int*,int*,int*,int*)const"> - <remove/> + <modify-argument index="return"> + <replace-type modified-type="PyObject" /> + </modify-argument> + <modify-argument index="1"> + <remove-argument /> + </modify-argument> + <modify-argument index="2"> + <remove-argument /> + </modify-argument> + <modify-argument index="3"> + <remove-argument /> + </modify-argument> + <modify-argument index="4"> + <remove-argument /> + </modify-argument> + <inject-code class="target"> + int a, b, c, d; + %CPPSELF.%FUNCTION_NAME(&a, &b, &c, &d); + %PYARG_0 = Shiboken::makeTuple(a, b, c, d); + </inject-code> </modify-function> <modify-function signature="getRect(int*,int*,int*,int*)const"> - <remove/> + <modify-argument index="return"> + <replace-type modified-type="PyObject" /> + </modify-argument> + <modify-argument index="1"> + <remove-argument /> + </modify-argument> + <modify-argument index="2"> + <remove-argument /> + </modify-argument> + <modify-argument index="3"> + <remove-argument /> + </modify-argument> + <modify-argument index="4"> + <remove-argument /> + </modify-argument> + <inject-code class="target"> + int a, b, c, d; + %CPPSELF.%FUNCTION_NAME(&a, &b, &c, &d); + %PYARG_0 = Shiboken::makeTuple(a, b, c, d); + </inject-code> </modify-function> </value-type> <value-type name="QRectF"> @@ -881,8 +919,50 @@ </insert-template> </inject-code> </add-function> - <modify-function signature="getCoords(qreal*,qreal*,qreal*,qreal*)const" remove="all" /> - <modify-function signature="getRect(qreal*,qreal*,qreal*,qreal*)const" remove="all" /> + <modify-function signature="getCoords(qreal*,qreal*,qreal*,qreal*)const"> + <modify-argument index="return"> + <replace-type modified-type="PyObject" /> + </modify-argument> + <modify-argument index="1"> + <remove-argument /> + </modify-argument> + <modify-argument index="2"> + <remove-argument /> + </modify-argument> + <modify-argument index="3"> + <remove-argument /> + </modify-argument> + <modify-argument index="4"> + <remove-argument /> + </modify-argument> + <inject-code class="target"> + qreal a, b, c, d; + %CPPSELF.%FUNCTION_NAME(&a, &b, &c, &d); + %PYARG_0 = Shiboken::makeTuple(a, b, c, d); + </inject-code> + </modify-function> + <modify-function signature="getRect(qreal*,qreal*,qreal*,qreal*)const"> + <modify-argument index="return"> + <replace-type modified-type="PyObject" /> + </modify-argument> + <modify-argument index="1"> + <remove-argument /> + </modify-argument> + <modify-argument index="2"> + <remove-argument /> + </modify-argument> + <modify-argument index="3"> + <remove-argument /> + </modify-argument> + <modify-argument index="4"> + <remove-argument /> + </modify-argument> + <inject-code class="target"> + qreal a, b, c, d; + %CPPSELF.%FUNCTION_NAME(&a, &b, &c, &d); + %PYARG_0 = Shiboken::makeTuple(a, b, c, d); + </inject-code> + </modify-function> </value-type> <value-type name="QSize" hash-function="PySide::hash"> <add-function signature="__reduce__" return-type="PyObject*"> diff --git a/tests/QtCore/qrect_test.py b/tests/QtCore/qrect_test.py index 3c5f5be..a6d38d9 100644 --- a/tests/QtCore/qrect_test.py +++ b/tests/QtCore/qrect_test.py @@ -3,7 +3,7 @@ import unittest -from PySide.QtCore import QPoint, QRect +from PySide.QtCore import QPoint, QRect, QRectF class RectConstructor(unittest.TestCase): @@ -97,6 +97,16 @@ class RectOperator(unittest.TestCase): rect3 = rect1 | rect2 self.assertEqual(rect3, rect1) + def testGetCoordsAndRect(self): + rect1 = QRect(1, 2, 3, 4) + self.assertEqual(rect1.getRect(), (1, 2, 3, 4)) + self.assertEqual(rect1.getCoords(), (1, 2, 3, 5)) + + rect1 = QRectF(1, 2, 3, 4) + self.assertEqual(rect1.getRect(), (1, 2, 3, 4)) + self.assertEqual(rect1.getCoords(), (1, 2, 4, 6)) + + if __name__ == '__main__': unittest.main() |