Revert "Fix binding loop and polish issue in quick layout"

This reverts commit 9ad9d05f26.

Reason for revert: QTBUG-120592

Change-Id: I6cba9e88832ac0d78280fd9d6f96b319748545be
Pick-to: 6.7 6.6 6.5
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
This commit is contained in:
Jani Heikkinen 2024-01-11 05:26:03 +00:00 committed by Jan Arve Sæther
parent 362a2dbcd7
commit cd5471fcd6
3 changed files with 8 additions and 81 deletions

View File

@ -925,7 +925,7 @@ void QQuickLayout::geometryChange(const QRectF &newGeometry, const QRectF &oldGe
{
Q_D(QQuickLayout);
QQuickItem::geometryChange(newGeometry, oldGeometry);
if (invalidated() || d->m_disableRearrange || !isReady())
if (d->m_disableRearrange || !isReady())
return;
qCDebug(lcQuickLayouts) << "QQuickLayout::geometryChange" << newGeometry << oldGeometry;

View File

@ -457,6 +457,10 @@ void QQuickGridLayoutBase::rearrange(const QSizeF &size)
return;
}
// Should normally not be needed, but there might be an incoming window resize event that we
// will process before we process updatePolish()
ensureLayoutItemsUpdated(QQuickLayout::ApplySizeHints | QQuickLayout::Recursive);
d->m_rearranging = true;
qCDebug(lcQuickLayouts) << objectName() << "QQuickGridLayoutBase::rearrange()" << size;
Qt::LayoutDirection visualDir = effectiveLayoutDirection();
@ -475,14 +479,9 @@ void QQuickGridLayoutBase::rearrange(const QSizeF &size)
d->engine.setGeometries(QRectF(QPointF(0,0), size), d->styleInfo);
d->m_rearranging = false;
if (d->m_invalidateAfterRearrange.size() > 0) {
for (QQuickItem *invalid : std::as_const(d->m_invalidateAfterRearrange)) {
if (QQuickGridLayoutItem *layoutItem = d->engine.findLayoutItem(invalid))
layoutItem->invalidate();
}
invalidate();
d->m_invalidateAfterRearrange.clear();
}
for (QQuickItem *invalid : std::as_const(d->m_invalidateAfterRearrange))
invalidate(invalid);
d->m_invalidateAfterRearrange.clear();
}
/**********************************

View File

@ -1289,78 +1289,6 @@ Item {
compare(row.implicitWidth, 2);
}
Component {
id: sizeHintBindingLoopComp
Item {
id: root
anchors.fill: parent
property var customWidth: 100
RowLayout {
id: col
Item {
id: item
implicitHeight: 80
implicitWidth: Math.max(col2.implicitWidth, root.customWidth + 20)
ColumnLayout {
id: col2
width: parent.width
Item {
id: rect
implicitWidth: root.customWidth
implicitHeight: 80
}
}
}
}
}
}
function test_sizeHintBindingLoopIssue() {
var item = createTemporaryObject(sizeHintBindingLoopComp, container)
waitForRendering(item)
item.customWidth += 10
waitForRendering(item)
verify(!BindingLoopDetector.bindingLoopDetected, "Detected binding loop")
BindingLoopDetector.reset()
}
Component {
id: polishLayoutItemComp
Item {
anchors.fill: parent
implicitHeight: contentLayout.implicitHeight
implicitWidth: contentLayout.implicitWidth
property alias textLayout: contentLayout
RowLayout {
width: parent.width
height: parent.height
ColumnLayout {
id: contentLayout
Layout.alignment: Qt.AlignHCenter | Qt.AlignTop
Layout.maximumWidth: 200
Repeater {
model: 2
Text {
Layout.fillWidth: true
text: "This is a long text causing line breaks to show the bug."
wrapMode: Text.Wrap
}
}
Item {
Layout.fillHeight: true
}
}
}
}
}
function test_polishLayoutItemIssue() {
var rootItem = createTemporaryObject(polishLayoutItemComp, container)
waitForRendering(rootItem)
var textItem = rootItem.textLayout.children[1]
verify(textItem.y >= rootItem.textLayout.children[0].height)
}
Component {
id: rearrangeNestedLayouts_Component
RowLayout {