qtbase (version 1.1.0)

qfindChild: Find child by name

Description

Finds a child QObject by name. Mirrors a function in Qt that is inaccessible via the ordinary interface because it is a template.

Usage

qfindChild(x, name)

Arguments

x
The parent QObject
name
The name of the child

Value

  • The child QObject

Details

This is particularly useful when working with QtDesigner, where objects in the UI file are named.

Examples

Run this code
parent <- Qt$QObject()
child <- Qt$QObject(parent)
child$objectName <- "foo"
qfindChild(parent, "foo")

Run the code above in your browser using DataCamp Workspace