Arranging items in GridView

  • 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.


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

    Is there some hidden property I'm missing?



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

    Thank you!

  • @
    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]

Log in to reply

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