Important: Please read the Qt Code of Conduct -

[solved] Dynamic Layout Management?

  • Hey!

    I'm looking for a way to manage the Layout of multiple Custom Widgets (more like plots) inside a QWidget.
    My plots have a fixed size (like 300200px) and are not set to be resizable. I want to add some (like 15-20) of those plots to a QWidget that will be resizable and has a minimum size of 600400px to fit in atleast 4 of my plots in a 22 layout. If those 4 plots are added and i start adding more the layout is "extended" in a dynamic way. First add another column, fill it with plots, add another row, fill it with plots and so on. So the 22 Layout becomes 23, 33, 34, 44....and so on. I hope u got the idea. This part i achieved using a gridLayout which works quite okay i think. Here comes the tricky part: In my solution the Plots are cascading each other if the QWidget is not big enough to show them all. So I want the QWidget to have scrollbars to stop the cascading of those plots and have them placed i the "not viewable" part in the QWidget.
    Another idea that came up with this, is to have the plot-placement in the QWidget to be dynamic too. So if I resize the QWidget to 900400px there is a 32 layout, if i resize to 900800px there is a 34 layout....and the plots being auto-arranged this way to have as much plots in the viewport as possible.
    I'm quite sure a lot of multi-window applications use this kind of layout but i couldn't figure out what this is called to find a tutorial or some code snippets to give me a little help on this problem.

    I hope there is anyone here understanding my idea and can help me by giving me a name for this kind of layout management.
    And sorry, I couldn't figure out a better name for the topic to describe what I'm looking for. Maybe it's bcs of my missing english skills - even in german this is hard to describe :D

  • I just modified the "flowlayout example": the way i needed it...problem (kind of) solved :)

Log in to reply