make QML ListView to be look like GridView
Unsolved
QML and Qt Quick
-
I have code which position images like grid using GridView. I need the same the same look only using ListView. Why i need this? Because ListView have section what doesn't have GridView. I want add images to section. Key for section will be date of image.
Here is how it looks now with GridView
It should look the same with ListView but i don't know how to do this. Her my code.Page { id: page JsonListModel { id: jsonModel source: page.jsonData keyField: "id" } GridView { id: view anchors.topMargin: dp(5) anchors.fill: parent cellWidth:(parent.width/3) cellHeight: cellWidth model: jsonModel clip: true boundsBehavior: Flickable.OvershootBounds // for flicking snapMode: ListView.SnapToItem // to stop at begin of item delegate: Item { id: photo property var view: GridView.view property var isCurrent: GridView.isCurrentItem height: view.cellHeight width: view.cellWidth AppImage { id: appImage anchors { rightMargin: { (index+1)%3 === 0 ? 0 : 3 } bottomMargin: dp(20) fill: parent } source: model.img_url } Text { anchors { horizontalCenter: parent.horizontalCenter top: appImage.bottom topMargin: dp(2) bottomMargin: dp(3) } renderType: Text.NativeRendering text: "%1%2".arg(model.text).arg(isCurrent ? " *" : "") font.pointSize: sp(9) } } } }
And how it should look