Fix cases where ensureAnchorsBounded() wasn't called

It wasn't called because the min size decreased, so setSize()
was a no-op, so ensureAnchorsBounded() was skipped.

But the internal widgets constraints can change, so still call ensureAnchorsBounded().
This commit is contained in:
Sergio Martins
2019-10-15 14:28:33 +01:00
parent c8d436d752
commit 7a6d2a1f6d

View File

@@ -418,7 +418,14 @@ void Item::onLayoutRequest() const
if (deltaW == 0 && deltaH == 0)
return; // min size shrunk, nothing to do
const QSize oldLayoutSize = d->m_layout->size();
d->m_layout->updateSizeConstraints();
const bool ranEnsureAnchorsBounded = oldLayoutSize != d->m_layout->size();
// setMinimumSize() and setSize() are no-ops if the size didn't change. So run ensureAnchorsBounded()
// ourselves, as the internal widgets changed their constraints
if (!ranEnsureAnchorsBounded)
d->m_layout->ensureAnchorsBounded();
if (width() < d->m_minSize.width() || height() < d->m_minSize.height()) {
// Shouldn't happen