diff --git a/doric-Qt/example/doric/shader/DoricScrollerNode.cpp b/doric-Qt/example/doric/shader/DoricScrollerNode.cpp index aad67ab3..375908b5 100644 --- a/doric-Qt/example/doric/shader/DoricScrollerNode.cpp +++ b/doric-Qt/example/doric/shader/DoricScrollerNode.cpp @@ -113,12 +113,11 @@ QSizeF DoricScrollerNode::sizeThatFits(QSizeF size) { ->property("doricLayout") .toULongLong(); - if (layout->getResolved()) { + if (!layout->getResolved()) { layout->apply(size); } - return QSizeF(qMax(size.width(), layout->getMeasuredWidth()), - qMax(size.height(), layout->getMeasuredHeight())); + return QSizeF(layout->getMeasuredWidth(), layout->getMeasuredHeight()); } DoricViewNode *DoricScrollerNode::getSubNodeById(QString id) { diff --git a/doric-Qt/example/doric/shader/DoricSuperNode.cpp b/doric-Qt/example/doric/shader/DoricSuperNode.cpp index 9f99db8b..6a047c42 100644 --- a/doric-Qt/example/doric/shader/DoricSuperNode.cpp +++ b/doric-Qt/example/doric/shader/DoricSuperNode.cpp @@ -12,6 +12,8 @@ void DoricSuperNode::blend(QQuickItem *view, QString name, QJsonValue prop) { mixinSubNode(subNode); blendSubNode(subNode); } + + getLayouts()->setResolved(false); } } else { DoricViewNode::blend(view, name, prop); diff --git a/doric-Qt/example/doric/shader/DoricTextNode.cpp b/doric-Qt/example/doric/shader/DoricTextNode.cpp index 92d3359b..92e323b4 100644 --- a/doric-Qt/example/doric/shader/DoricTextNode.cpp +++ b/doric-Qt/example/doric/shader/DoricTextNode.cpp @@ -98,3 +98,9 @@ void DoricTextNode::blend(QQuickItem *view, QString name, QJsonValue prop) { DoricViewNode::blend(view, name, prop); } } + +void DoricTextNode::blend(QJsonValue jsValue) { + DoricViewNode::blend(jsValue); + + getLayouts()->setResolved(false); +} diff --git a/doric-Qt/example/doric/shader/DoricTextNode.h b/doric-Qt/example/doric/shader/DoricTextNode.h index d3cabe33..8c64c875 100644 --- a/doric-Qt/example/doric/shader/DoricTextNode.h +++ b/doric-Qt/example/doric/shader/DoricTextNode.h @@ -13,6 +13,8 @@ public: virtual void blendLayoutConfig(QJsonValue jsObject) override; + virtual void blend(QJsonValue jsValue) override; + virtual void blend(QQuickItem *view, QString name, QJsonValue prop) override; }; diff --git a/doric-Qt/example/doric/utils/DoricLayouts.cpp b/doric-Qt/example/doric/utils/DoricLayouts.cpp index 8bd00e84..53327a3b 100644 --- a/doric-Qt/example/doric/utils/DoricLayouts.cpp +++ b/doric-Qt/example/doric/utils/DoricLayouts.cpp @@ -753,3 +753,5 @@ void DoricLayouts::setMeasuredY(qreal measuredY) { } bool DoricLayouts::getResolved() { return resolved; } + +void DoricLayouts::setResolved(bool resolved) { this->resolved = resolved; } diff --git a/doric-Qt/example/doric/utils/DoricLayouts.h b/doric-Qt/example/doric/utils/DoricLayouts.h index c7d66e0c..e9926b94 100644 --- a/doric-Qt/example/doric/utils/DoricLayouts.h +++ b/doric-Qt/example/doric/utils/DoricLayouts.h @@ -94,6 +94,7 @@ public: qreal getMeasuredHeight(); bool getResolved(); + void setResolved(bool resolved); private: QString tag;