GridLayout problems



  • I'm having two related problems with GridLayout objects, both revolving around the use of Layout.fillWidth and Layout.fillHeight to get constant sized cells that their contents can anchor themselves to. I believe they also apply to RowLayout and ColumnLayout

    First, some of my children use Layout.columnSpan or Layout.rowSpan. But when I do this, even though the extra columns or rows are "occupied", the fillWidth or fillHeight doesn't seem to apply to the extra columns or rows. If this is W.A.D, I can't imagine why anyone would D. it this way--it looks like a bug to me. My "solution" is to create dummy items that force the other columns or rows to be filled. But this isn't without its problems. For instance, if I have a GridLayout with five columns, and I want to attach a child that is five columns wide (say as a title in the top row), and some of the columns are otherwise unoccupied, I can create a dummy Item with its Layer properties set to occupy those columns. But if I can't find a row in which there isn't something already spanning those columns, then the item clashes with one of the real items I want to display. This "works", but it produces an error message in the log, e.g., QGridLayoutEngine::addItem: Cell (0, 4) already taken.

    BTW, I've found that I only need to insert enough dummy single-cell items to define all the grid boundaries. In the above example, I'd need a dummy in columns 1 and 3, because that's enough to define boundaries 0-1, 1-2, 2-3, and 3-4:

        0       1       2       3       4
    +---------------------------------------+
    |              colSpan = 5              |
    +-------+-------+-------+-------+-------+
            | dummy |       | dummy |
            +-------+       +-------+
    

    Second, I specify a spacing on the GridLayout, but sometimes I want a double-wide gap, so I treat that as just another row or column that has nothing in it, and that should therefore have a zero height or width. But when I do that, I don't get the extra spacing--it acts as if the row or column just doesn't exist. Again, W.A.D.? But why? My "solution" is to place a dummy Item into the empty row with its Layout.fillWidth set, but obviously not Layout.fillHeight (or the opposite for an empty column).

    These are pretty ugly hacks, they junk up the source code, and they're error-prone. Does anyone have any better ideas on how to do either of these things? Does anyone think they could be called bugs?


  • Banned

    This post is deleted!



  • Lifetime Qt Champion

    Hi,

    It was spam.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.