diff options
Diffstat (limited to 'sources/pyside6/PySide6/templates/widgets_common.xml')
-rw-r--r-- | sources/pyside6/PySide6/templates/widgets_common.xml | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/sources/pyside6/PySide6/templates/widgets_common.xml b/sources/pyside6/PySide6/templates/widgets_common.xml new file mode 100644 index 000000000..b0dee43cd --- /dev/null +++ b/sources/pyside6/PySide6/templates/widgets_common.xml @@ -0,0 +1,55 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +// Copyright (C) 2018 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +--> +<typesystem> + + <template name="replace_child"> + $CHILD_TYPE* oldChild = %CPPSELF.$FUNCTION_GET_OLD(); + if (oldChild && (oldChild != $CPPARG)) { + Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[$CHILD_TYPE*](oldChild)); + Shiboken::Object::setParent(nullptr, pyChild); + Shiboken::Object::releaseOwnership(pyChild); + } + Shiboken::Object::setParent(%PYSELF, $PYARG); + </template> + + <template name="qgraphicsitem_pysequence"> + const Py_ssize_t numItems = PySequence_Size(%PYARG_1); + Shiboken::AutoArrayPointer<QGraphicsItem*> %out(numItems); + for (Py_ssize_t i = 0; i < numItems; ++i) { + %out[i] = %CONVERTTOCPP[QGraphicsItem*](PySequence_Fast_GET_ITEM(%PYARG_1, i)); + } + </template> + + <template name="qgraphicsitem_pyobject"> + Shiboken::AutoDecRef object(PyList_New(0)); + for (int i=0, max=numItems; i < max; i++) { + PyList_Append(object, %CONVERTTOPYTHON[QGraphicsItem*](%in[i])); + } + PyObject *%out = object.object(); + </template> + + <template name="qstyleoptiongraphicsitem_pyobject"> + Shiboken::AutoDecRef option_object(PyList_New(0)); + for (int i=0, max=numItems; i < max; i++) { + const QStyleOptionGraphicsItem* item = &%in[i]; + PyList_Append(option_object, %CONVERTTOPYTHON[QStyleOptionGraphicsItem](item)); + } + PyObject* %out = option_object.object(); + </template> + + <template name="pysequence_qstyleoptiongraphicsitem"> + const Py_ssize_t numOptions = PySequence_Size(%PYARG_2); + Shiboken::AutoArrayPointer<QStyleOptionGraphicsItem> %out(numOptions); + for (Py_ssize_t i=0; i < numOptions; ++i) { + %out[i] = %CONVERTTOCPP[QStyleOptionGraphicsItem](PySequence_Fast_GET_ITEM(%PYARG_1, i)); + } + </template> + + <template name="pysequencesize_int"> + int %out = PySequence_Size(%PYARG_1); + </template> + +</typesystem> |