layout bug fix

This commit is contained in:
王劲鹏 2021-05-28 13:27:11 +08:00 committed by osborn
parent 4c427fc257
commit af1ef2a103
3 changed files with 10 additions and 3 deletions

View File

@ -112,10 +112,13 @@ QSizeF DoricScrollerNode::sizeThatFits(QSizeF size) {
DoricLayouts *layout = (DoricLayouts *)mChildNode->getNodeView() DoricLayouts *layout = (DoricLayouts *)mChildNode->getNodeView()
->property("doricLayout") ->property("doricLayout")
.toULongLong(); .toULongLong();
layout->apply(size);
return QSizeF(qMin(size.width(), layout->getMeasuredWidth()), if (layout->getResolved()) {
qMin(size.height(), layout->getMeasuredHeight())); layout->apply(size);
}
return QSizeF(qMax(size.width(), layout->getMeasuredWidth()),
qMax(size.height(), layout->getMeasuredHeight()));
} }
DoricViewNode *DoricScrollerNode::getSubNodeById(QString id) { DoricViewNode *DoricScrollerNode::getSubNodeById(QString id) {

View File

@ -751,3 +751,5 @@ void DoricLayouts::setMeasuredY(qreal measuredY) {
qCritical() << "DoricLayouts: " << tag << this->view->property("uuid") qCritical() << "DoricLayouts: " << tag << this->view->property("uuid")
<< " measuredY: " << this->measuredY; << " measuredY: " << this->measuredY;
} }
bool DoricLayouts::getResolved() { return resolved; }

View File

@ -93,6 +93,8 @@ public:
qreal getMeasuredWidth(); qreal getMeasuredWidth();
qreal getMeasuredHeight(); qreal getMeasuredHeight();
bool getResolved();
private: private:
QString tag; QString tag;