Fixing the size of a StatusBar
-
In my app I have a StatusBar containing a RowLayout and a bunch of Items. One of the items is a ProgressBar, on which the visible property becomes true if the app is busy doing something. In other words, when the app is idle, the ProgressBar is no longer visible. When this happens, the RowLayout's height shrinks to the maximum height of the other things in the StatusBar.
So I have a StatusBar that changes height constantly; obviously not ideal. Is there some way I can hint that the RowLayout maintain its height, even if its contained items are not visible? I can of course just set a fixed height for the RowLayout, but this second guesses the minimum height of its children. For example, what happens in the future if it's decided that ProgressBar heights should double? Now my fixed size StatusBar is too small.
This seems like it must be a common problem, but I can't seem to come up with the solution. Any hints please?
Thanks.
-
In case anyone else has this problem, adding this to the RowLayout does the trick:
Rectangle { height: rowLayout.childrenRect.height }
The Rectangle by default has 0 width, and the RowLayout's childrenRect.height property has the value we're after, i.e. the maximum height of its children, visible or not. Bit of a hack, obviously.