diff options
author | Jani Heikkinen <jani.heikkinen@qt.io> | 2024-01-11 05:26:03 +0000 |
---|---|---|
committer | Jan Arve Sæther <jan-arve.saether@qt.io> | 2024-01-12 06:33:24 +0100 |
commit | cd5471fcd6f3d4c22fed0fdfac5abca5e51c1064 (patch) | |
tree | 218a509f8accae1831061042209a9ed3e112bd00 | |
parent | 362a2dbcd7a46306cde168115492d9cd081c5bc2 (diff) |
Revert "Fix binding loop and polish issue in quick layout"
This reverts commit 9ad9d05f26184a79ad3fe09abdc662949088d19d.
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>
-rw-r--r-- | src/quicklayouts/qquicklayout.cpp | 2 | ||||
-rw-r--r-- | src/quicklayouts/qquicklinearlayout.cpp | 15 | ||||
-rw-r--r-- | tests/auto/quick/qquicklayouts/data/tst_rowlayout.qml | 72 |
3 files changed, 8 insertions, 81 deletions
diff --git a/src/quicklayouts/qquicklayout.cpp b/src/quicklayouts/qquicklayout.cpp index 28a99ced9e..5a6b30ff38 100644 --- a/src/quicklayouts/qquicklayout.cpp +++ b/src/quicklayouts/qquicklayout.cpp @@ -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; diff --git a/src/quicklayouts/qquicklinearlayout.cpp b/src/quicklayouts/qquicklinearlayout.cpp index e6c5a1261b..31c1857d9f 100644 --- a/src/quicklayouts/qquicklinearlayout.cpp +++ b/src/quicklayouts/qquicklinearlayout.cpp @@ -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(); } /********************************** diff --git a/tests/auto/quick/qquicklayouts/data/tst_rowlayout.qml b/tests/auto/quick/qquicklayouts/data/tst_rowlayout.qml index e89e76d15e..92ceb2e95a 100644 --- a/tests/auto/quick/qquicklayouts/data/tst_rowlayout.qml +++ b/tests/auto/quick/qquicklayouts/data/tst_rowlayout.qml @@ -1290,78 +1290,6 @@ Item { } 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 { id: layout |