fix scroll node cannot scroll

This commit is contained in:
王劲鹏
2021-04-16 16:44:08 +08:00
committed by osborn
parent 3207cc2581
commit 7950416ba6
6 changed files with 79 additions and 37 deletions

View File

@@ -72,7 +72,10 @@ void DoricScrollerNode::afterBlended(QJsonValue jsValue) {
mChildNode->init(this);
mChildNode->blend(props);
mChildNode->getNodeView()->setParentItem(parent);
QQmlListProperty<QQuickItem> contentChildren =
qvariant_cast<QQmlListProperty<QQuickItem>>(
parent->property("contentChildren"));
contentChildren.append(&contentChildren, mChildNode->getNodeView());
}
}
} else {
@@ -81,13 +84,24 @@ void DoricScrollerNode::afterBlended(QJsonValue jsValue) {
mChildNode->init(this);
mChildNode->blend(props);
mChildNode->getNodeView()->setParentItem(parent);
QQmlListProperty<QQuickItem> contentChildren =
qvariant_cast<QQmlListProperty<QQuickItem>>(
parent->property("contentChildren"));
contentChildren.append(&contentChildren, mChildNode->getNodeView());
}
}
void DoricScrollerNode::requestLayout() {
this->mChildNode->requestLayout();
getLayouts()->apply(mView->width(), mView->height());
DoricLayouts *layout = (DoricLayouts *)(mChildNode->getNodeView()
->property("doricLayout")
.toULongLong());
if (layout != nullptr) {
layout->apply(mView->width(), mView->height());
mView->setProperty("contentWidth", layout->getMeasuredWidth());
mView->setProperty("contentHeight", layout->getMeasuredHeight());
}
}
void DoricScrollerNode::blendSubNode(QJsonValue subProperties) {