Quantcast
Channel: Active questions tagged qtquick2 - Stack Overflow
Viewing all articles
Browse latest Browse all 137

QML Repeater parentness

$
0
0

Let's say I have 2 types of custom elements — Parent and Child.

And there can be more than one Parent in the scene.

A simple scene looks like this:

Parent {    Child {        id: child1    }    Child {        id: child2    }}

After the scene is loaded, I want to initialize all the Children in Parent class:

void InitializeChildren() {    list = findChildren<Child*>(QString(),Qt::FindChildrenRecursively);    foreach(Child * child,list) {        InitChild(this,child);}

But it fails with a more complicated scene:

Parent {    Rectangle {        Repeater {            model: 10            delegate: Child {            }        }    }    }

Just because the Repeater has no Child objects as children.

How can I get all Child's objects if I know exactly that they are nested children of the specified Parent?


Viewing all articles
Browse latest Browse all 137

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>