Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. GridLayout problems
Forum Update on Monday, May 27th 2025

GridLayout problems

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
3 Posts 3 Posters 900 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    pderocco
    wrote on 5 Dec 2018, 21:53 last edited by
    #1

    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?

    1 Reply Last reply
    0
    • P Offline
      P Offline
      pderocco
      wrote on 7 Dec 2018, 23:41 last edited by
      #2

      @Lucinda183 WTF?

      1 Reply Last reply
      0
      • S Offline
        S Offline
        SGaist
        Lifetime Qt Champion
        wrote on 8 Dec 2018, 15:44 last edited by
        #3

        Hi,

        It was spam.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0

        2/3

        7 Dec 2018, 23:41

        • Login

        • Login or register to search.
        2 out of 3
        • First post
          2/3
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved