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. Arranging items in GridView
Forum Updated to NodeBB v4.3 + New Features

Arranging items in GridView

Scheduled Pinned Locked Moved QML and Qt Quick
4 Posts 3 Posters 1.9k 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.
  • T Offline
    T Offline
    TilmanK
    wrote on last edited by
    #1

    Hi there,

    I've got some trouble layouting my Grid. I'm taking image filenames from an xml file and arrange them in an Grid. Problem is, that I need to load them into my GridView in columns and not in rows.

    Example

    1. Image 4. Image
    2. Image 5. Image
    3. Image 6. ...

    Is there some hidden property I'm missing?

    Thanks,

    Tilman

    1 Reply Last reply
    0
    • L Offline
      L Offline
      ludde
      wrote on last edited by
      #2

      How about the "flow":http://doc-snapshot.qt-project.org/4.8/qml-gridview.html#flow-prop property?

      1 Reply Last reply
      0
      • T Offline
        T Offline
        TilmanK
        wrote on last edited by
        #3

        I was looking through that doc page several times this morning. I could bet someone just added that entry :)

        Thank you!

        1 Reply Last reply
        0
        • U Offline
          U Offline
          Umesh
          wrote on last edited by
          #4

          @
          import QtQuick 1.0

          Rectangle {
          id: main
          width: 640
          height: 360
          Grid {
          id: grid
          rows: 5
          columns: 3
          flow: Grid.TopToBottom
          Repeater {
          id: repeater
          model: grid.rows*grid.columns
          Rectangle {
          width: 50
          height: 50
          color: "transparent"
          border.color: "blue"
          border.width: 2
          Text {
          id: text
          text: index
          anchors.centerIn: parent
          }
          }
          }
          }
          }
          @
          you can use this code to arrange the items column wise.
          i just set the "flow" property of grid, as Mr. Ludde said in the comment

          [Edit: Added @ tags for code formatting. Please be sure to use them in the future! -- mlong]

          1 Reply Last reply
          0

          • Login

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