Problem with GridView
-
wrote on 1 Aug 2020, 22:32 last edited by
I am trying to display a list of images, and strings which I have setup in the C++ in this
GridView
, but for some reason, it isn't working. I know the list is populated because I can display both images in this manner:Row { spacing: 5 IconButton { id: cardOne rounded: false imageSource: mod_data.optionsListImages[0] text: mod_data.optionsList[0] } IconButton { id: cardTwo rounded: false imageSource: mod_data.optionsListImages[1] text: mod_data.optionsList[1] } }
However, when I use
GridView
orListView
to try and display them only one image shows up:Item { id: sectionGridViewContainer GridView { id: sectionGridView anchors.fill: parent cellHeight: 282 cellWidth: parent.width/3 model: mod_data.optionsListImages delegate: IconButton { id: delegateThing rounded: false imageSource: modelData } } }
Any idea what I am doing wrong? Could this be a bug?
-
I am trying to display a list of images, and strings which I have setup in the C++ in this
GridView
, but for some reason, it isn't working. I know the list is populated because I can display both images in this manner:Row { spacing: 5 IconButton { id: cardOne rounded: false imageSource: mod_data.optionsListImages[0] text: mod_data.optionsList[0] } IconButton { id: cardTwo rounded: false imageSource: mod_data.optionsListImages[1] text: mod_data.optionsList[1] } }
However, when I use
GridView
orListView
to try and display them only one image shows up:Item { id: sectionGridViewContainer GridView { id: sectionGridView anchors.fill: parent cellHeight: 282 cellWidth: parent.width/3 model: mod_data.optionsListImages delegate: IconButton { id: delegateThing rounded: false imageSource: modelData } } }
Any idea what I am doing wrong? Could this be a bug?
wrote on 2 Aug 2020, 01:38 last edited by@RobM Ah I figured it out. It would seem that
Row
is somehow capable of setting it's parent elements width whileGridView
andListView
are not. So, I had to set the parent elements width first, then bind theGridView
correctly for everything to display.
1/2