0
votes

I'm currently working with PyQt5, where I'm designing a GUI using the Qt Designer app.

However, I'm encountering a strange behavior where, within a layout (could be horizontal / vertical), the stretch factor between two elements is not infinitely tunable, and actually depends on the size of the layout window.

Here's an example:

enter image description here

So this is a standard vertical layout with two empty list widgets inside where I applied a stretch factor of 1,3. Now basically I cannot apply any bigger stretch factor. Changing the 1,3 to 1,5 for instance, doesn't affect the layout.

enter image description here

However, if the overall size of the layout is increased, the factor 1,5 can be applied

enter image description here

So my question is: Is there a way to force any stretch factor no matter the size of the layout window?

(I already verified my min and max sizes, and they're set to : enter image description here )

1
Could you post the contents of the .ui file you are using in the example?Heike

1 Answers

1
votes

This behaviour is controlled by the minimumSizeHint. The minimum size must be explicitly set to a non-zero value in order for the layout to resize smaller than the minimum size hint. Alternatively, the size-policy could be to Ignored. So either of the settings shown below should work for your example:

enter image description here

With a layout stretch of 1,5, this will now allow resizing like this:

enter image description here