[Interest] constraining minimum widget size

André Somers andre at familiesomers.nl
Wed Sep 23 10:52:18 CEST 2015

Op 23-9-2015 om 09:07 schreef Hamish Moffatt:
> I want to be able to set the minimum size for a container widget 
> without ignoring the minimum sizes of the children. ie I want to 
> constrain the minimum size of the container, not override it. Is this 
> possible?
> Here's what I mean. Let's say I have a QFrame with a QVBoxLayout 
> containing a couple of widgets, for example QRadioButton. I want this 
> QFrame to be a particular size, no smaller (it looks silly), big 
> enough to contain the child widgets, but no bigger. The size policies 
> on the frame and radio buttons are all minimum.
> If I set the minimumSize property on the QFrame, I get the minimum 
> size I requested - but now the QFrame ignores the minimum sizes of the 
> children, so if the children require more room they are clipped. For 
> example if the user is using 150% font scaling in Windows...
> Examples: no minimum size, with a minimum size set, with the minimum 
> size set but larger fonts...
> If I were writing a custom widget then overriding 
> sizeHint()/minimumSizeHint() might help, but I want to do this in Qt 
> Designer/Creator using the standard container widgets. Is it possible?
I would say just adding a vertical spacer in your layout with a minimum 
height should do the trick as well?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20150923/c0f74c22/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/png
Size: 23403 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20150923/c0f74c22/attachment.png>

More information about the Interest mailing list