aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside2
diff options
context:
space:
mode:
authorCristian Maureira-Fredes <cristian.maureira-fredes@qt.io>2018-08-23 14:17:32 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2018-09-12 07:02:20 +0000
commit0b7417825ad16e3d3603c30750994b3a1be8b651 (patch)
tree7b7ee8779457bee818fc996857ab13b45c05b4c6 /sources/pyside2
parente2a074516d657baa64af141cb680dd7651002ece (diff)
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 <tismer@stackless.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'sources/pyside2')
-rw-r--r--sources/pyside2/PySide2/QtCore/typesystem_core_common.xml16
1 files changed, 16 insertions, 0 deletions
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 @@
<inject-code class="native" file="glue/qobject_findchild.cpp"/>
<add-function signature="findChild(PyTypeObject*,const QString&amp;)" return-type="PyObject*">
+ <inject-documentation format="target" mode="append">
+ 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")
+
+ </inject-documentation>
<inject-code class="target" position="beginning">
QObject *child = _findChildHelper(%CPPSELF, %2, (PyTypeObject*)%PYARG_1);
%PYARG_0 = %CONVERTTOPYTHON[QObject*](child);
@@ -2311,6 +2324,9 @@
</modify-argument>
</add-function>
<add-function signature="findChildren(PyTypeObject*,const QString&amp;)" return-type="PySequence*" >
+ <inject-documentation format="target" mode="append">
+ Like the method *findChild*, the first parameter should be the child's type.
+ </inject-documentation>
<inject-code class="target" position="beginning">
%PYARG_0 = PyList_New(0);
_findChildrenHelper(%CPPSELF, %2, (PyTypeObject*)%PYARG_1, %PYARG_0);