So first something regarding your title: I have no idea what you consider the delegate data but maybe we will still find a satisfying answer.
For your error, I would say, it is expected. Let's break down your code into smaller parts:
mpMainLayerWnd = mpWnd->findChild<QQuickItem*>("main_layer_wnd"); // 1
QVariant prop = mpMainLayerWnd->property("contentItem") // 2
QQuickItem* content = prop.value<QQuickItem*>(); // 3
QList<QQuickItem*> list = content->childItems(); // 4
- You find the child. This should be ok, and you'll have a
QQuickItem* in mpMainLayerWnd
- You try to read the property
contentItem that does not exist. You get an empty QVariant.
- You try to convert the content of the empty
QVariant to a QQuickItem*, which will result in nullptr
- You try to access a method of a
nullptr.
=> There is no method childItems() on a nullptr
What is unclear to my, why you expect to have contentItem in a Repeater, since non such is documented in QObject, QQuickItem nor in Repeater.
Most likely you mix up a default property with contentItem. The default property is the property to which QML automatically assigns everything you create within the { } of an object, without assigning it to some other property.
Item {
id: rootItem
Item { // this will go to the rootItems default property (data)
}
}
The next thing is what I was wondering in the beginning: what is the delegate data you try to access? Do you want to get the Component? Then you can read the property delegate of the Repeater.
You want to get the instances of the delegate? Here I am a bit lost. I think they are in the children() of the Repeater, and in the childItem() of the Repeaters parent.