Hi Alex!
Sorry it’s taken so long to respond!
I originally set the page of my app needing this with GridView – where each list element had its own custom icon from image source etc,
I was told originally that to do this I would need to link it to the columns in the Grid (as you’ve done above)
I am a bit of a newbie and repeaters still make little to no sense to me especially adding custom text/images to one repeater object,
Thanks for your help, I managed to adapt it too function in GridView where I can’t specify columns by the following code below:
P.S For anyone else looking at what I’ve done, the key factor was giving my Page an ‘id’ and linking the gridview cell width to this, then dividing by 2, or how ever many ‘columns’ you wish to create! As I didn’t want my items displayed to be too the edge, like they were when I did this, I used the scale ability to bring them in a touch! (or however much you want)
Alex, please let me know if this would be considered a viable option haha!!!
Thanks a million, Edward.
Page {
id:page
GridView {
id: gridView
anchors.horizontalCenter: parent.horizontalCenter
width: parent.width
height: 450
anchors.top: slideshow.bottom
anchors.topMargin: dp(10)
cellWidth: page.width / 2
cellHeight: cellWidth
model: ListModel {
ListElement {
name: "Browse/Shop"
icon: "../assets/Icons/Basket.png"
page: "Pages/Store.qml"
}
ListElement {
name: "News&Offers"
icon: "../assets/Icons/News.png"
page: "Pages/NewsOffers.qml"
}
ListElement {
name: "Live Chat"
icon: "../assets/Icons/Group.png"
page: "Pages/LiveChat.qml"
}
ListElement {
name: "Help"
icon: "../assets/Icons/Help.png"
page: "Pages/Help.qml"
}
}
delegate: Item {
width: gridView.cellWidth
height: gridView.cellHeight
scale: 0.8
Rectangle {
anchors.fill: parent
radius: dp(12)
border.color: "black"
border.width: dp(3)
Text { text: name; fontSizeMode: Text.Fit; font.family: Theme.normalFont.name; font.pixelSize: 24; color: "black"; anchors.horizontalCenter: parent.horizontalCenter;anchors.top: parent.top; anchors.topMargin: dp(5)}
Image {
id: myIcon
anchors.fill: parent
scale: 0.4
y: 20; anchors.horizontalCenter: parent.horizontalCenter
source: icon
}
MouseArea {
anchors.fill: parent
onClicked: navigationStack.push(Qt.resolvedUrl(page))
}
}
}
}
}