Important: Please read the Qt Code of Conduct -

Push buttons display in a "nice" layout, full-screen...

  • My intention is to provide a GUI with two sections, one of which displays k buttons, where k is the number of .txt files in a specific folder. I would be glad to know that there is a way to to simply add buttons (largest possible), still "nicely" arranged in a full screen window. In other words, I would like to only add push buttons, and these would be automatically arranged for me (no specification of coordinates and sizes).

    The initial window should be full screen, and buttons should be as large as possible. Any description on how this might be achieved, with pointers to existing examples, is highly appreciated.

  • Lifetime Qt Champion


    Are you thinking about something like the "Graphics View Flow Layout Example" ?

  • Well, I was thinking about having buttons of the same size that is determined according to the screen size. So, the buttons could be placed in a grid that occupies the whole screen. Any example in this direction is highly appreciated (and thanks for the provided example, I have it)

  • The sample code produced almost the desired result, thanks. There are some issues that still need to be addressed:

    1. in main.cpp, I state view->showMaximized(); but that results in maximization of the "background" window, while the one where buttons are stays in the size that is dependent on the number of buttons. How could I maximize the "actual" window where buttons are.

    2. where could the button size be manipulated (method name)?

    [quote author="SGaist" date="1413979802"]Hi,

    Are you thinking about something like the "Graphics View Flow Layout Example" ?[/quote]

  • Lifetime Qt Champion

    I just remembered you also have the "Flow Layout Example" that only uses widget.

    1. I can't tell since I don't know your code

    2. resize, setFixedSize

Log in to reply