so i have to show 9 images on my page, so I have used repeater, but the problem is that I want to show the images in a row, but in out put it shows in a column. I am working on a mobile application using qml. So can anybody suggest me how to show it in a row format using qml?
Here is my code
ColumnLayout {
spacing: 10
clip:true
Repeater{
model: 9
Row{
id:icons
spacing:30
Layout.alignment: Qt.AlignHCenter
Image {
id: img1
source:"path to images"
height: 50
width:50
}
}
}
}
Solved! Go to Solution.
Read up on GridLayout which allows you to specify the maximum number of columns
Do a google search for "qml layout" and you will see there are several layout types.
You are using ColumnLayout which is why they are displayed in a column. Try RowLayout or GridLayout for different options.
Yeah it was a silly mistake. but can you suggest me how can i put a condition that in one row it only can consist of 4 images if it will more than 4 then after 4th image it will be in 2nd line. well i am showing images dynamically it's not hard coded
Read up on GridLayout which allows you to specify the maximum number of columns
thanks it worked