diff --git a/doric-Qt/example/doric/shader/DoricScrollerNode.cpp b/doric-Qt/example/doric/shader/DoricScrollerNode.cpp index c31c425b..aad67ab3 100644 --- a/doric-Qt/example/doric/shader/DoricScrollerNode.cpp +++ b/doric-Qt/example/doric/shader/DoricScrollerNode.cpp @@ -112,10 +112,13 @@ QSizeF DoricScrollerNode::sizeThatFits(QSizeF size) { DoricLayouts *layout = (DoricLayouts *)mChildNode->getNodeView() ->property("doricLayout") .toULongLong(); - layout->apply(size); - return QSizeF(qMin(size.width(), layout->getMeasuredWidth()), - qMin(size.height(), layout->getMeasuredHeight())); + if (layout->getResolved()) { + layout->apply(size); + } + + return QSizeF(qMax(size.width(), layout->getMeasuredWidth()), + qMax(size.height(), layout->getMeasuredHeight())); } DoricViewNode *DoricScrollerNode::getSubNodeById(QString id) { diff --git a/doric-Qt/example/doric/utils/DoricLayouts.cpp b/doric-Qt/example/doric/utils/DoricLayouts.cpp index 19bb5697..8bd00e84 100644 --- a/doric-Qt/example/doric/utils/DoricLayouts.cpp +++ b/doric-Qt/example/doric/utils/DoricLayouts.cpp @@ -751,3 +751,5 @@ void DoricLayouts::setMeasuredY(qreal measuredY) { qCritical() << "DoricLayouts: " << tag << this->view->property("uuid") << " measuredY: " << this->measuredY; } + +bool DoricLayouts::getResolved() { return resolved; } diff --git a/doric-Qt/example/doric/utils/DoricLayouts.h b/doric-Qt/example/doric/utils/DoricLayouts.h index 6df1ab7f..c7d66e0c 100644 --- a/doric-Qt/example/doric/utils/DoricLayouts.h +++ b/doric-Qt/example/doric/utils/DoricLayouts.h @@ -93,6 +93,8 @@ public: qreal getMeasuredWidth(); qreal getMeasuredHeight(); + bool getResolved(); + private: QString tag;