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.
Example
- Image 4. Image
- Image 5. Image
- Image 6. ...
Is there some hidden property I'm missing?
Thanks,
Tilman
-
How about the "flow":http://doc-snapshot.qt-project.org/4.8/qml-gridview.html#flow-prop property?
-
I was looking through that doc page several times this morning. I could bet someone just added that entry :)
Thank you!
-
@
import QtQuick 1.0Rectangle {
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]