ChiliPalmer
28th March 2012, 17:35
Hi,
I have created a container widget that you can open and close.
It's opened and closed by a QPropertyAnimation, which animates its size property. Before starting the animation I disable the layout, if present, and enable it again when the animation has finished. The animations valueChanged signal is connected to a slot that calls updateGeometry().
In most cases it works like a charm, the widgets inside the container keep their sizes and positions while other widgets, that share a layout with the container, are resized.
But there are two circumstances where the container just jumps from on state to the next, without animation:
1. A widget within the container, e.g an ItemView, has as vertical sizePolicy QSizePolicy::Expanding oder QSizePolicy::MinimumExpanding. This I really don't get, because as I disable the layout, the widgets sizePolicy shouldn't matter, right?
2. The container has a vertical stretch factor other than 0.
Is there any way around those problems? Right now, the only two solutions I see are to hide the container's child widgets before animating, or to animate both minimumSize and maximumSize and reset both to the standard values when the animations have finished. But I like neither of those solutions.
I have created a container widget that you can open and close.
It's opened and closed by a QPropertyAnimation, which animates its size property. Before starting the animation I disable the layout, if present, and enable it again when the animation has finished. The animations valueChanged signal is connected to a slot that calls updateGeometry().
In most cases it works like a charm, the widgets inside the container keep their sizes and positions while other widgets, that share a layout with the container, are resized.
But there are two circumstances where the container just jumps from on state to the next, without animation:
1. A widget within the container, e.g an ItemView, has as vertical sizePolicy QSizePolicy::Expanding oder QSizePolicy::MinimumExpanding. This I really don't get, because as I disable the layout, the widgets sizePolicy shouldn't matter, right?
2. The container has a vertical stretch factor other than 0.
Is there any way around those problems? Right now, the only two solutions I see are to hide the container's child widgets before animating, or to animate both minimumSize and maximumSize and reset both to the standard values when the animations have finished. But I like neither of those solutions.