fix layout bug
This commit is contained in:
parent
738566e043
commit
50f80a3fe4
@ -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) {
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
|
@ -753,3 +753,5 @@ void DoricLayouts::setMeasuredY(qreal measuredY) {
|
||||
}
|
||||
|
||||
bool DoricLayouts::getResolved() { return resolved; }
|
||||
|
||||
void DoricLayouts::setResolved(bool resolved) { this->resolved = resolved; }
|
||||
|
@ -94,6 +94,7 @@ public:
|
||||
qreal getMeasuredHeight();
|
||||
|
||||
bool getResolved();
|
||||
void setResolved(bool resolved);
|
||||
|
||||
private:
|
||||
QString tag;
|
||||
|
Reference in New Issue
Block a user