From 0b7417825ad16e3d3603c30750994b3a1be8b651 Mon Sep 17 00:00:00 2001 From: Cristian Maureira-Fredes Date: Thu, 23 Aug 2018 14:17:32 +0200 Subject: Add explanation to findChild/findChildren methods The error message when use these methods was not explaining that the first argument needed to be the parent's type. This adds a small phrase a code snippet that clarify the situation. Task-number: PYSIDE-776 Task-number: PYSIDE-691 Change-Id: I0af57d65065b6d87f195d5f42fd1140a864c5edf Reviewed-by: Christian Tismer Reviewed-by: Friedemann Kleint --- .../pyside2/PySide2/QtCore/typesystem_core_common.xml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'sources/pyside2/PySide2/QtCore') diff --git a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml index cc9b5e519..5c5102528 100644 --- a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml +++ b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml @@ -2299,6 +2299,19 @@ + + To find the child of a certain QObject, the first argument of this function should be the child's type, and the second the name of the child: + + :: + + ... + parent = QWidget() + ... + # The first argument must be the child type + child1 = parent.findChild(QPushButton, "child_button") + child2 = parent.findChild(QWidget, "child_widget") + + QObject *child = _findChildHelper(%CPPSELF, %2, (PyTypeObject*)%PYARG_1); %PYARG_0 = %CONVERTTOPYTHON[QObject*](child); @@ -2311,6 +2324,9 @@ + + Like the method *findChild*, the first parameter should be the child's type. + %PYARG_0 = PyList_New(0); _findChildrenHelper(%CPPSELF, %2, (PyTypeObject*)%PYARG_1, %PYARG_0); -- cgit v1.2.3