I am trying to use findChildren
to pull a list of parameters from my program. The code is below:
QList<QPointer<TParameter> > theFullParameterList;
foreach(TParameter *child, this->findChildren<TParameter* >())
{
theFullParameterList << QPointer<TParameter>(child);
}
It compiles fine but but When I go into (this) within debug, there are several member types of QPointer<TParameter>
but my theFullParameterList
comes up empty. TParameter
is a custom class. Is there any way to find the children of that class that are within a QPointer
?
A couple of questions:
1) Are you sure that such instances of that class is not destroyed when you call
findChildren
?2) Are you sure to set the parent to the class instances?
I'm able to populate the
QList
with the following code:And the output:
Size of list: 10