diff --git a/doric-Qt/example/doric/resources/slider.qml b/doric-Qt/example/doric/resources/slider.qml index e6a0a4fb..17bf3616 100644 --- a/doric-Qt/example/doric/resources/slider.qml +++ b/doric-Qt/example/doric/resources/slider.qml @@ -40,4 +40,9 @@ SwipeView { onBorderColorChanged: { bg.border.color = borderColor } + + onCurrentIndexChanged: { + console.log(tag, uuid + " onCurrentIndexChanged: " + this.currentIndex) + } + } diff --git a/doric-Qt/example/doric/shader/slider/DoricSliderNode.cpp b/doric-Qt/example/doric/shader/slider/DoricSliderNode.cpp index d076206c..546f91ed 100644 --- a/doric-Qt/example/doric/shader/slider/DoricSliderNode.cpp +++ b/doric-Qt/example/doric/shader/slider/DoricSliderNode.cpp @@ -67,6 +67,10 @@ void DoricSliderNode::afterBlended(QJsonValue prop) { QJsonDocument document = QJsonDocument::fromJson(jsValueString.toUtf8()); QJsonArray jsValue = document.array(); + QQmlListProperty contentChildren = + qvariant_cast>( + 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"]); }