Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-40399

QML GridLayout (and RowLayout, ColumnLayout) don't support margins.

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Duplicate
    • P3: Somewhat important
    • None
    • 5.3.1
    • Quick: Layouts
    • None

    Description

      Consider the following common layout task:

      ColumnLayout {
         RowLayout {
            // Label, text field, button
         }
         RowLayout {
            // Label, Spin box
         }
         RowLayout {
            // Button, button
         }
      }
      

      Currently it is virtually impossible to do all that layout correctly with nice looking margins.

      1. `anchors.margin:` doesn't work when not using anchors.
      2. `spacing:` only affects things inside the layout, it can't be used to add spacing around the layout.
      3. You can add dummy spacer `Item`s but that only lets you add fake margins in the dimension of the layout (i.e. vertically for a ColumnLayout, horizontally for a RowLayout).

      I'm not saying it's not impossible. It's just not nearly as easy as I've come to expect from Qt.

      The solution is pretty easy, just create a `Layout.margins` similar to `anchor.margins`.

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              smd Jan Arve
              timmmm Tim
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes