From 710f680240b56429c50d005a52816843d72af8b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=8A=B2=E9=B9=8F?= Date: Mon, 7 Jun 2021 16:19:00 +0800 Subject: [PATCH] change implement of blend sub node --- doric-Qt/example/doric/shader/DoricFlexNode.cpp | 12 +++++++++--- doric-Qt/example/doric/shader/DoricSuperNode.h | 4 ++-- doric-Qt/example/doric/shader/DoricViewNode.cpp | 6 +++++- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/doric-Qt/example/doric/shader/DoricFlexNode.cpp b/doric-Qt/example/doric/shader/DoricFlexNode.cpp index c1772368..7faf5adb 100644 --- a/doric-Qt/example/doric/shader/DoricFlexNode.cpp +++ b/doric-Qt/example/doric/shader/DoricFlexNode.cpp @@ -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"; +} diff --git a/doric-Qt/example/doric/shader/DoricSuperNode.h b/doric-Qt/example/doric/shader/DoricSuperNode.h index cedeb16f..41584cf9 100644 --- a/doric-Qt/example/doric/shader/DoricSuperNode.h +++ b/doric-Qt/example/doric/shader/DoricSuperNode.h @@ -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); diff --git a/doric-Qt/example/doric/shader/DoricViewNode.cpp b/doric-Qt/example/doric/shader/DoricViewNode.cpp index 30b7c6f1..1aedb642 100644 --- a/doric-Qt/example/doric/shader/DoricViewNode.cpp +++ b/doric-Qt/example/doric/shader/DoricViewNode.cpp @@ -88,7 +88,11 @@ QQuickItem *DoricViewNode::getNodeView() { return mView; } void DoricViewNode::blend(QJsonValue jsValue) { QJsonValue value = jsValue["layoutConfig"]; if (value.isObject()) { - setLayoutConfig(value); + if (mSuperNode != nullptr) { + mSuperNode->blendSubNode(this, value); + } else { + setLayoutConfig(value); + } } foreach (const QString &key, jsValue.toObject().keys()) {