how to display items from model in varying sizes?
-
wrote on 11 Jun 2024, 23:38 last edited by mzimmers 6 Nov 2024, 23:39
Hi all -
I need to display the items of a model on a page that will show the items 4 across, except for certain items which need to be 2x wide as the others.
I tried using a GridView for this:
GridView { id: gridView property int nbrColumns: 4 cellWidth: Layout.preferredWidth / nbrColumns cellHeight: 72 model: 6 delegate: Pane { id: cellPane height: GridView.view.cellHeight width: (index === 2) ? (GridView.view.cellWidth * 2) : GridView.view.cellWidth
but that produces this:
which is close to what I want, but the item with index 3 should not overlay item 2, but instead be on the next row.I would try using a GridLayout, but I don't know how I would "feed" model data to a Layout.
Anyone have any other ideas?
Thanks...
-
Hi all -
I need to display the items of a model on a page that will show the items 4 across, except for certain items which need to be 2x wide as the others.
I tried using a GridView for this:
GridView { id: gridView property int nbrColumns: 4 cellWidth: Layout.preferredWidth / nbrColumns cellHeight: 72 model: 6 delegate: Pane { id: cellPane height: GridView.view.cellHeight width: (index === 2) ? (GridView.view.cellWidth * 2) : GridView.view.cellWidth
but that produces this:
which is close to what I want, but the item with index 3 should not overlay item 2, but instead be on the next row.I would try using a GridLayout, but I don't know how I would "feed" model data to a Layout.
Anyone have any other ideas?
Thanks...
wrote on 12 Jun 2024, 04:02 last edited by@mzimmers said in how to display items from model in varying sizes?:
I would try using a GridLayout, but I don't know how I would "feed" model data to a Layout.
-
wrote on 13 Jun 2024, 02:18 last edited by
Perfect. Thanks.
-
-
@mzimmers said in how to display items from model in varying sizes?:
I would try using a GridLayout, but I don't know how I would "feed" model data to a Layout.
wrote on 1 Aug 2024, 16:49 last edited by@jeremy_k said in how to display items from model in varying sizes?:
@mzimmers said in how to display items from model in varying sizes?:
I would try using a GridLayout, but I don't know how I would "feed" model data to a Layout.
Thanks
3/4