Required QT hints

I am working on a simple board game in qt and I have some layout issues. I have two players, their health is represented by pixmaps at the bottom of the screen. It now looks something like this:

Layout

Note that I would like to keep the health indicators on opposite sides of the screen and the button centered to the center of the screen.

BUT, when some of the players lose health, this happens:

Layout messed up

If the picture is not clear, here I have taken several screens:

enter image description here

So the problem is that the button in the middle starts to shift to one of the edges of the screen due to the spacers. I understand why it does this, but I just can't seem to find a solution.

Please, if you have any ideas how I can make this layout, please help me! Thanks in advance!

+3


source to share


2 answers


Make a blank (completely transparent) display of the health indicator image the same size as the raster map. Then you can always place three equal image sizes for the labels for both players.



+3


source


You can place a widget where your health bar should be, set its sizePolicy to a fixed size, and place a health bar chart in that widget.



+2


source







All Articles