Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Fixing the size of a StatusBar
QtWS25 Last Chance

Fixing the size of a StatusBar

Scheduled Pinned Locked Moved QML and Qt Quick
visibilitystatus barrowlayout
2 Posts 1 Posters 1.6k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Tim Angus
    wrote on 9 Jul 2015, 21:54 last edited by
    #1

    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.

    1 Reply Last reply
    0
    • T Offline
      T Offline
      Tim Angus
      wrote on 10 Jul 2015, 14:18 last edited by
      #2

      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.

      1 Reply Last reply
      0

      2/2

      10 Jul 2015, 14:18

      • Login

      • Login or register to search.
      2 out of 2
      • First post
        2/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved