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. Grid layout spacing issue (Solved)
Forum Updated to NodeBB v4.3 + New Features

Grid layout spacing issue (Solved)

Scheduled Pinned Locked Moved QML and Qt Quick
6 Posts 3 Posters 2.2k Views 1 Watching
  • 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on 20 Mar 2014, 09:40 last edited by
    #1

    Hi,

    I have cerated two grid layout inside a Rowlayout. It is working fine as i can see that each gridlayout with buttons.

    But i have a problem that one gridlayout conists of 5 buttons and another one with 4 buttons. When i see the output the alignment looks in different size for each grids. If i provide same buttons for two grids then it will show the same alignment. But is there any way i can manage this without adding another button to make both equal.

    Ansif

    1 Reply Last reply
    0
    • O Offline
      O Offline
      onek24
      wrote on 20 Mar 2014, 09:48 last edited by
      #2

      Hello,

      you can set the Layout.minimumWidth: on the thiner or both Layouts. Just set them both to half of the window and they will use a minimum of half of the window:
      @Rectangle {
      width: 300; height: 300
      RowLayout {
      GridLayout {
      Layout.minimumWidth: 150
      }
      GridLayout {
      Layout.minimumWidth: 150
      }
      }
      }@

      For further information please read:
      "Layout":https://qt-project.org/doc/qt-5.1/qtquicklayouts/qml-qtquick-layouts1-layout.html

      1 Reply Last reply
      0
      • T Offline
        T Offline
        Tân Ngọc Đỗ
        wrote on 21 Mar 2014, 10:11 last edited by
        #3

        Hello, You can also span one button for more than one row using Layout.rowSpan

        1 Reply Last reply
        0
        • O Offline
          O Offline
          onek24
          wrote on 21 Mar 2014, 10:18 last edited by
          #4

          Or use an invisible Rectangle to fill a row. :)

          1 Reply Last reply
          0
          • ? Offline
            ? Offline
            A Former User
            wrote on 21 Mar 2014, 11:31 last edited by
            #5

            [quote author="onek24" date="1395397082"]Or use an invisible Rectangle to fill a row. :)[/quote]

            Hi,

            Thanks gain and sorry for the late reply.
            I have tried rowspan and its working fine. Anyway the last options is nice, as we can set opacity of a button to -1 and it will create an empty space there.
            Any way my problem is solved, thanks again.

            Cheers
            Ansif

            1 Reply Last reply
            0
            • O Offline
              O Offline
              onek24
              wrote on 21 Mar 2014, 11:33 last edited by
              #6

              Hey,

              i'm glad that it is solved. You can also set the color of the rectangle to "transparent", that will work too. Anyways, please add [solved] to the topic, thank you.

              Alex

              1 Reply Last reply
              0

              1/6

              20 Mar 2014, 09:40

              • Login

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