Important: Please read the Qt Code of Conduct -

Automatic layout for Qt GUIs

  • Hi all!!

    The automatic layout for GUI elements is the research topic we are addressing now.
    It is a process in which the widgets composing a GUI are automatically arranged depending on the relationships between them, and on the features of the container dialog. Initial widgets' layout (if exist) is broken, and a new QAutomaticLayout is added in order to arrange all the elements in a container/dialog/window. The arrangement process is level-based (a container widget represents a new level).

    You can see it working in the following video: "":

    You can find further information about this project and other related ones in the Cátedra SAES website ("":

    Please, send me your impressions, suggestions, likes, dislikes, etc. We would like to improve the prototype and, as the rest of our work, release it as an open-source contribution.


  • That looks quite interesting, i must say! Seeing this all opensourced would be a great addition, methinks :) Calling it a QAutomaticLayout seems a little fun, mind, as the Q classes tend to indicate something which lives inside the Qt framework itself... So one small suggestion would be that, to avoid confusion, it might be worth it to not call your class that - an example of that approach is KDAB's widgets, such as KDChart :)

  • just changed!!!
    thanks leinir.

  • Looks interesting, but I failed to find info about project at your website.

  • It's interesting, can we see this prototype code?

  • Hi again!!!

    Sorry Denis, but these results are very recent, so we have not yet created any documentation. We would like to write something to present all the details of this solution.

    Alexander, we are finishing this first prototype. Note that the video was recorded this morning, so it shows the first results we obtained. There is a lot of remaining work, but we will try to share the code as soon as possible.

    Our idea is to improve it as much as possible, and implement it to allow developers to choose (and also implement) among several arrangement strategies.

    I will send a new post when any documentation and/or the code are available.

    Thanks a lot for your comments!!

  • pedromateo, ok, I will wait for your next post :)
    What about licenses? Will it be under lgpl?

  • [quote author="Denis Kormalev" date="1291232855"]pedromateo, ok, I will wait for your next post :)
    What about licenses? Will it be under lgpl?[/quote]

    Hi Denis,

    all of our work is released under the lgpl license, because one of the principles underlying our organization is to share our results in order to obtain feedback from the community.
    However, another of our goals is writing papers. So, I do not know if I can free the details of this design before the paper is written.

    Nevertheles, if I can, I will post some process details or pieces of code for people to give me some feedback and try to improve this solution. Thus don't worry, I will free this code as soon as I can.

    Best Regards.

  • Great work Pedro!

    As everyone else here in the forums, I like to see code, so I guess we should wait for that :)

  • Hi!!!

    Now I am working on improving the arrangement strategy to support some "extreme" cases in which the elements of the initial GUI are very very misplaced.

    I think that a GUI in which the elements are distributed like a square, that is, all the widgets are distributed all over the available space (please, see the video above), it seems the GUI is better arranged because, if for example we divide the GUI space into 4 similar sub-squares, all of them have a similar "weight".

    However, GUIs can be composed of a very heterogeneous group of elements, so I think trying to get always a square shape could be "dangerous".

    What do you think about this?

    Thnaks, and Regards

  • Could you explain how the relationships between the elements are defined? The video does not show that.

  • [quote author="Andre" date="1295001044"]Could you explain how the relationships between the elements are defined? The video does not show that.[/quote]

    Hi Andre,

    now I can't give you details about how the relatinships between widgets are defined. We are wondering whether to create a new paper an then an open-source contribution related to this idea.

    However, I can say you that the position of each widget is compared to the position of closer widgets, and then is ordered according to its position inside the container which is holding it.

    I will provide you with further details ass soon as I can.


Log in to reply