fix parent is scroller error
This commit is contained in:
parent
644f58e221
commit
3655513be3
@ -132,16 +132,22 @@ void DoricLayouts::measureSelf(QSizeF targetSize) {
|
|||||||
qreal width;
|
qreal width;
|
||||||
if (this->widthSpec == DoricLayoutSpec::DoricLayoutMost) {
|
if (this->widthSpec == DoricLayoutSpec::DoricLayoutMost) {
|
||||||
QQuickItem *parent = this->view->parentItem();
|
QQuickItem *parent = this->view->parentItem();
|
||||||
DoricLayouts *parentDoricLayout =
|
if (parent == nullptr) {
|
||||||
(DoricLayouts *)(parent->property("doricLayout").toULongLong());
|
// incase parent is scroller
|
||||||
if (parentDoricLayout != nullptr &&
|
|
||||||
parentDoricLayout->layoutType == DoricLayoutType::DoricHLayout &&
|
|
||||||
this->weight > 0) {
|
|
||||||
width = 0;
|
|
||||||
setMeasuredWidth(0);
|
|
||||||
} else {
|
|
||||||
width = targetSize.width();
|
width = targetSize.width();
|
||||||
setMeasuredWidth(targetSize.width());
|
setMeasuredWidth(targetSize.width());
|
||||||
|
} else {
|
||||||
|
DoricLayouts *parentDoricLayout =
|
||||||
|
(DoricLayouts *)(parent->property("doricLayout").toULongLong());
|
||||||
|
if (parentDoricLayout != nullptr &&
|
||||||
|
parentDoricLayout->layoutType == DoricLayoutType::DoricHLayout &&
|
||||||
|
this->weight > 0) {
|
||||||
|
width = 0;
|
||||||
|
setMeasuredWidth(0);
|
||||||
|
} else {
|
||||||
|
width = targetSize.width();
|
||||||
|
setMeasuredWidth(targetSize.width());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (this->widthSpec == DoricLayoutSpec::DoricLayoutJust) {
|
} else if (this->widthSpec == DoricLayoutSpec::DoricLayoutJust) {
|
||||||
width = this->width;
|
width = this->width;
|
||||||
@ -154,17 +160,24 @@ void DoricLayouts::measureSelf(QSizeF targetSize) {
|
|||||||
qreal height;
|
qreal height;
|
||||||
if (this->heightSpec == DoricLayoutSpec::DoricLayoutMost) {
|
if (this->heightSpec == DoricLayoutSpec::DoricLayoutMost) {
|
||||||
QQuickItem *parent = this->view->parentItem();
|
QQuickItem *parent = this->view->parentItem();
|
||||||
DoricLayouts *parentDoricLayout =
|
if (parent == nullptr) {
|
||||||
(DoricLayouts *)(parent->property("doricLayout").toULongLong());
|
// incase parent is scroller
|
||||||
if (parentDoricLayout != nullptr &&
|
|
||||||
parentDoricLayout->layoutType == DoricLayoutType::DoricVLayout &&
|
|
||||||
this->weight > 0) {
|
|
||||||
height = 0;
|
|
||||||
setMeasuredHeight(0);
|
|
||||||
} else {
|
|
||||||
height = targetSize.height();
|
height = targetSize.height();
|
||||||
setMeasuredHeight(targetSize.height());
|
setMeasuredHeight(targetSize.height());
|
||||||
|
} else {
|
||||||
|
DoricLayouts *parentDoricLayout =
|
||||||
|
(DoricLayouts *)(parent->property("doricLayout").toULongLong());
|
||||||
|
if (parentDoricLayout != nullptr &&
|
||||||
|
parentDoricLayout->layoutType == DoricLayoutType::DoricVLayout &&
|
||||||
|
this->weight > 0) {
|
||||||
|
height = 0;
|
||||||
|
setMeasuredHeight(0);
|
||||||
|
} else {
|
||||||
|
height = targetSize.height();
|
||||||
|
setMeasuredHeight(targetSize.height());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (this->heightSpec == DoricLayoutSpec::DoricLayoutJust) {
|
} else if (this->heightSpec == DoricLayoutSpec::DoricLayoutJust) {
|
||||||
height = this->height;
|
height = this->height;
|
||||||
setMeasuredHeight(this->height);
|
setMeasuredHeight(this->height);
|
||||||
|
Reference in New Issue
Block a user