<table><tr><td style="">amhndu added a comment.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D15625">View Revision</a></tr></table><br /><div><div><blockquote style="border-left: 3px solid #a7b5bf; color: #464c5c; font-style: italic; margin: 4px 0 12px 0; padding: 4px 12px; background-color: #f8f9fc;"><p>Which could happen independently of us providing proper minimumSizeHints, by code that is broken or confused (think custom styles) or otherwise forced to go beyond our hints. The API dox of QLayoutItem::setGeometry(const QRect &r) does not forbid to set rects smaller than the minimumSizeHint() or even a 0 size rect.</p></blockquote>

<p>From <a href="http://doc.qt.io/qt-5/qlayout.html#details" class="remarkup-link" target="_blank" rel="noreferrer">http://doc.qt.io/qt-5/qlayout.html#details</a>:</p>

<blockquote style="border-left: 3px solid #a7b5bf; color: #464c5c; font-style: italic; margin: 4px 0 12px 0; padding: 4px 12px; background-color: #f8f9fc;"><p>You should also implement minimumSize() to ensure your layout isn't resized to zero size if there is too little space.</p></blockquote>

<p>And <a href="http://doc.qt.io/qt-5/qlayout.html#SizeConstraint-enum" class="remarkup-link" target="_blank" rel="noreferrer">http://doc.qt.io/qt-5/qlayout.html#SizeConstraint-enum</a></p>

<p>From my understanding, if we set the size constraint in the layout (analogous to how we set it in the tool button, but I missed setting it here in layout) appropriately, Qt classes will follow it. And like the original bug, would resize the window if necessary.<br />
Though I'm not against doing a <tt style="background: #ebebeb; font-size: 13px;">rect.width() < minimumSize().width</tt> check in the <tt style="background: #ebebeb; font-size: 13px;">doHorizontalLayout</tt>, even if redundant, which should be cheap.</p>

<blockquote style="border-left: 3px solid #a7b5bf; color: #464c5c; font-style: italic; margin: 4px 0 12px 0; padding: 4px 12px; background-color: #f8f9fc;"><p>I am slighty uneasy with the explosion of code we add now, where ideally we could just delegate things to existing Qt code.</p></blockquote>

<p>If IdealLayout were to inherit from QBoxLayout, we might be able to delegate minimumSize and sizeHint. And maybe even setGeometry.</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R32 KDevelop</div></div></div><br /><div><strong>BRANCH</strong><div><div>segfault-fix</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D15625">https://phabricator.kde.org/D15625</a></div></div><br /><div><strong>To: </strong>amhndu, KDevelop, kossebau, rjvbb<br /><strong>Cc: </strong>kossebau, rjvbb, kdevelop-devel, glebaccon, antismap, iodelay, vbspam, geetamc, Pilzschaf, akshaydeo, surgenight, arrowd<br /></div>