aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6/PySide6/glue/qtwidgets.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2025-02-18 16:25:26 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2025-02-20 12:50:20 +0100
commitc8fd99efaf3a9ad012680c50c61478e4ffb57fb6 (patch)
treecf452d6a659ee64a4c982ad8bdb34e26344e3353 /sources/pyside6/PySide6/glue/qtwidgets.cpp
parent96e016d95d8e37eb76492ab45dc454767ccb21b6 (diff)
shiboken6: Enable code snippets for templates
Prototypically move some template code from QtGui into snippets. [ChangeLog][shiboken6] It is now possible to use file snippets for XML template content. Change-Id: Ifb23407819c843e9059225a5bd269d954f837ee3 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
Diffstat (limited to 'sources/pyside6/PySide6/glue/qtwidgets.cpp')
-rw-r--r--sources/pyside6/PySide6/glue/qtwidgets.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/sources/pyside6/PySide6/glue/qtwidgets.cpp b/sources/pyside6/PySide6/glue/qtwidgets.cpp
index bc9dc99d6..c085cb062 100644
--- a/sources/pyside6/PySide6/glue/qtwidgets.cpp
+++ b/sources/pyside6/PySide6/glue/qtwidgets.cpp
@@ -815,6 +815,16 @@ if (!PySide::callConnect(%PYSELF, SIGNAL(accepted()), %PYARG_1))
%CPPSELF.%FUNCTION_NAME();
// @snippet qmessagebox-open-connect-accept
+// @snippet replace-widget-child
+$CHILD_TYPE* oldChild = %CPPSELF.$FUNCTION_GET_OLD();
+if (oldChild != nullptr && oldChild != $CPPARG) {
+ Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[$CHILD_TYPE*](oldChild));
+ Shiboken::Object::setParent(nullptr, pyChild);
+ Shiboken::Object::releaseOwnership(pyChild);
+}
+Shiboken::Object::setParent(%PYSELF, $PYARG);
+// @snippet replace-widget-child
+
/*********************************************************************
* CONVERSIONS
********************************************************************/