I have a widget to insert that looks like this
+--------------------+
| +-------++-------+ |
| | || | |
| | || | |
| | || Label | |
| | Label || Label | |
| | || | |
| | || | |
| +-------++-------+ |
+--------------------+
A QWidget element containing two QVBoxLayouts, each containing one or more QLabels.
This Widget is going to be inserted in a Vertical Layout that has a stretch cell, so all the widgets of this kind will go to the top and shrink to the smaller height possible.
Resulting in something like this.
______________________ ← Layout boundary
+--------------------+
| +-------++-------+ |
| | || Label | |
| | Label || Label | | ← Widget shrunk to the smallest
| +-------++-------+ |
+--------------------+
______________________ ← Layout boundary
↑
|
| ← Spacer
|
↓
______________________ ← Layout boundary
But before doing this insert, I want to know the size that the widget would have in the inserted layout. Maybe the minimum size allowed by its internal layout. Not sure how to call it.
I have tried already many approaches like inserting the widget in an alternate invisible layout so I can retrieve its height when inserted, which should be the same that the widget would take when inserted in my definitive layout.
But for some reason I always get 480 or 478 when the widget is at most 50px height when pressed vertically. So I am totally lost.
I have to do this because I need the widget to animate when inserting, and I need to know the height it will take for me to animate from height 1 to it.
How can I do this?