change implement of blend sub node

This commit is contained in:
王劲鹏 2021-06-07 16:19:00 +08:00 committed by osborn
parent dca581d641
commit 710f680240
3 changed files with 16 additions and 6 deletions

View File

@ -26,8 +26,14 @@ void DoricFlexNode::blend(QQuickItem *view, QString name, QJsonValue prop) {
}
void DoricFlexNode::blendSubNode(DoricViewNode *subNode,
QJsonValue flexConfig) {}
QJsonValue flexConfig) {
qDebug() << "blendSubNode";
}
void DoricFlexNode::blendYoga(YGLayout *yoga, QJsonValue flexConfig) {}
void DoricFlexNode::blendYoga(YGLayout *yoga, QJsonValue flexConfig) {
qDebug() << "blendYoga";
}
void DoricFlexNode::blendYoga(YGLayout *yoga, QString name, QJsonValue prop) {}
void DoricFlexNode::blendYoga(YGLayout *yoga, QString name, QJsonValue prop) {
qDebug() << "blendYoga";
}

View File

@ -16,8 +16,6 @@ protected:
virtual void blendSubNode(QJsonValue subProperties) = 0;
virtual void blendSubNode(DoricViewNode *subNode, QJsonValue layoutConfig);
void recursiveMixin(QJsonValue src, QJsonValue target);
public:
@ -31,6 +29,8 @@ public:
virtual DoricViewNode *getSubNodeById(QString id) = 0;
virtual void blendSubNode(DoricViewNode *subNode, QJsonValue layoutConfig);
private:
void mixinSubNode(QJsonValue subNode);

View File

@ -88,8 +88,12 @@ QQuickItem *DoricViewNode::getNodeView() { return mView; }
void DoricViewNode::blend(QJsonValue jsValue) {
QJsonValue value = jsValue["layoutConfig"];
if (value.isObject()) {
if (mSuperNode != nullptr) {
mSuperNode->blendSubNode(this, value);
} else {
setLayoutConfig(value);
}
}
foreach (const QString &key, jsValue.toObject().keys()) {
QJsonValue value = jsValue[key];