Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

[SOLVED] Layout Management - Grid Layout



  • Hi,

    I would like to achieve a GridLayout similar to this :
    https://www.dropbox.com/s/fj51uqlusrijc78/gridInterface.png
    Of course this is just an example I will not copy the design.

    I tried with a QGridLayout, no option to show "lines" between items.
    I tried with a QTableWidget, seems like a lot of works to edit the grid so in order to show specifics lines only, and have header with icons

    Is there a better alternative? Maybe just a standard QGridLayout and simulate the lines with QFrame ?

    Thanks!



  • QGridLayout with QFrame is a good alternative with a nice look. but my line cannot overlap.. searching for a solution now



  • Hi,

    you could also use style sheets to achieve such a result.



  • I just hit a wall with the QFrame in a QGridLayout.
    The widget cannot "overlap" so my line are not continue

    Here's a screenshot:
    https://www.dropbox.com/s/ge1riijk8icf3wh/gridTestInterface.png



  • I would just like the white line to continue a little more, I tried negative margin but not working. there's probably a solution with stylesheet?

    Current Interface:
    https://www.dropbox.com/s/ge1riijk8icf3wh/gridTestInterface.png
    ( I want to vertical white line to be uninterrupted)

    Current stylesheet:
    @/* vertical lines /
    QFrame#frame_vline, #frame_vline_2, #frame_vline_3 {
    color: rgb(255,255,255);
    margin-bottom:-15px; /
    not working, I would like the line to continue over just a few pixel.. */
    }@



  • Found a solution, but not 100% what I would like.
    I have to edit the generated ui_[file].h and force column span

    I cannot find a way to do it with designer yet.
    gridLayout->addWidget(frame_vline_2, 0, 1, 3, 1);



  • Okay it is possible to overlap widget in gridLayout
    You just cannot do it with Designer

    have to open to ui file with Text editor and add rowspan manually to the xml
    Then it display good in designer and no need to write code ;)

    <item row="0" column="6" rowspan="4">
    <widget class="QFrame" name="frame_vline_4">


Log in to reply