change append child method

This commit is contained in:
王劲鹏 2021-06-01 16:15:05 +08:00 committed by osborn
parent 69e550886b
commit 9f1839f2f7
2 changed files with 10 additions and 1 deletions

View File

@ -40,4 +40,9 @@ SwipeView {
onBorderColorChanged: {
bg.border.color = borderColor
}
onCurrentIndexChanged: {
console.log(tag, uuid + " onCurrentIndexChanged: " + this.currentIndex)
}
}

View File

@ -67,6 +67,10 @@ void DoricSliderNode::afterBlended(QJsonValue prop) {
QJsonDocument document = QJsonDocument::fromJson(jsValueString.toUtf8());
QJsonArray jsValue = document.array();
QQmlListProperty<QQuickItem> contentChildren =
qvariant_cast<QQmlListProperty<QQuickItem>>(
mView->property("contentChildren"));
for (int i = 0; i != jsValue.size(); i++) {
QJsonValue model = jsValue.at(i);
QString id = model["id"].toString();
@ -77,7 +81,7 @@ void DoricSliderNode::afterBlended(QJsonValue prop) {
newNode->init(this);
this->childNodes.append((DoricSlideItemNode *)newNode);
newNode->getNodeView()->setParentItem(mView);
contentChildren.append(&contentChildren, newNode->getNodeView());
newNode->blend(model["props"]);
}