D15625: Sublime: Fix crash caused when all tool view items are small
Amish Naidu
noreply at phabricator.kde.org
Wed Sep 26 08:56:16 BST 2018
amhndu added a comment.
> 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.
From http://doc.qt.io/qt-5/qlayout.html#details:
> You should also implement minimumSize() to ensure your layout isn't resized to zero size if there is too little space.
And http://doc.qt.io/qt-5/qlayout.html#SizeConstraint-enum
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.
Though I'm not against doing a `rect.width() < minimumSize().width` check in the `doHorizontalLayout`, even if redundant, which should be cheap.
> I am slighty uneasy with the explosion of code we add now, where ideally we could just delegate things to existing Qt code.
If IdealLayout were to inherit from QBoxLayout, we might be able to delegate minimumSize and sizeHint. And maybe even setGeometry.
REPOSITORY
R32 KDevelop
BRANCH
segfault-fix
REVISION DETAIL
https://phabricator.kde.org/D15625
To: amhndu, #kdevelop, kossebau, rjvbb
Cc: kossebau, rjvbb, kdevelop-devel, glebaccon, antismap, iodelay, vbspam, geetamc, Pilzschaf, akshaydeo, surgenight, arrowd
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20180926/83b68841/attachment.html>
More information about the KDevelop-devel
mailing list