Search code examples
qtpyqtqt-designerpyside6

Qt designer: layout with a resizing plot, but controls with fixed size


Note, this is not the same as this question, which regards spacers and buttons being too large for their containing layout while resizing.

Instead, I want to set a fixed size to one of the direct children of a HLayout, to make it a non-resizing pane. I read here that I should rather control the size of the contained widgets, but that would be rather cumbersome, given the hierarchy of the pane that I want at constant width.

I am trying to create a window design, that features:

  • an animated plot on the right
  • a left pane with line edits, buttons.
  • the size of the plot changes with the size of the main window
  • the left pane has a fixed width and stays flush on the left.

I have tried multiple combinations of Layouts, Frames, Widgets, to no av. This is what I have now:

enter image description here

As expected, the plot_layout does not show in the preview, since there is no widget within. Fine.

enter image description here

Here is what happens when I resize the application window. Reasonable:

enter image description here

Wide controls, instead of wide plot, not so reasonable: enter image description here

I suspect that this partially has to do with how I create the plot (it's a matplotlib plot, I use FigureCanvasQTAgg and add it plot_layout as a widget). But even so, I would like to fix the whole left pane's width, no matter the figure size.


Solution

  • This configuration works to achieve my goal:

    enter image description here