ack
ack

Reputation: 14985

PyQT: get recursive children of a widget

Anyone have a slick function that will return a nested tree of all the children of a particular widget?

I'm familiar with dumpObjectTree() but I'm not able to compile in debug mode, so I don't have access to that function.

Trying to find a particular widget and I'm traversing the children() hierarchy by hand. There's got to be a better way!

Upvotes: 4

Views: 10475

Answers (2)

Mr. Frobenius
Mr. Frobenius

Reputation: 324

I found that a QObject has a dumpObjectTree method at this link. Is that what you're looking for?

Upvotes: 0

Kaleb Pederson
Kaleb Pederson

Reputation: 46499

QObject.findChild (or findChildren) will recursively search for a child and should do what you need.

Upvotes: 4

Related Questions