Question

I have a widget hierarchy like this, with a frame (in order to set a background color behind the buttons and label) and a horizontal layout as its direct child.

Widget hierarchy

However, the horizontal layout (red frame in below screenshot of Qt Designer) does not take up the whole space inside the frame. How can I do that? Changing the property "layoutSizeConstraint" does not work. The label is already set to "Expanding" in horizontal direction, but still it keeps its size – I can resize the horizontal layout manually, but it should fill the width automatically.

Layout not expanded

Was it helpful?

Solution

Your frame frame doesn't have a layout (it's shown on its icon in the tree). It's because you have added new QHBoxLayout and dragged it into a frame. You should remove this layout, drag the label and buttons to the frame, then open frame's context menu and choose "Layout" option and choose desired layout.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top