[Interest] findChildren() in destroyed() signal slot

Bo Thorsen bo at fioniasoftware.dk
Mon Mar 19 18:01:48 CET 2012

Den 19-03-2012 17:10, Jason Cipriani skrev:
> Thanks. I need an accurate list of children in response to a child's
> destroyed signal, so is the best way to do this, then, to have Parent
> maintain its own list of Children, rather than using findChildren(), and
> use the destroyed(QObject*) version of the signal to explicitly remove
> the Child from the Parents list?

Pseudocode, fill in the blanks yourself:

// At child construction time:
connect(newChild, SIGNAL(destroyed(QObject*), 

void Parent::childDestroyed(QObject* child);
   QObjectList children = findChildren<QObject*>();
   // TADAA

Bo Thorsen,
Fionia Software.


Expert Qt and C++ developer for hire
Contact me if you need expert Qt help

More information about the Interest mailing list