From 7a6d2a1f6d0905a50984e8a3efe720c0f4ee20e2 Mon Sep 17 00:00:00 2001 From: Sergio Martins Date: Tue, 15 Oct 2019 14:28:33 +0100 Subject: [PATCH] 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(). --- src/multisplitter/Item.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/multisplitter/Item.cpp b/src/multisplitter/Item.cpp index 5743c26c..b3cabea5 100644 --- a/src/multisplitter/Item.cpp +++ b/src/multisplitter/Item.cpp @@ -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