ListView how to insert objects to contentarea which are not inside the model (so not ot be repeated)?
-
hello guys...
so long story short, i have a listview, and to be able to be scrollable i need to delegate it to the component...
however also in this scrollable area i need to put some onf my own objects (Text, Image, etc), and after that I need to put the Component which will repeate based on the model.so far this is fine, however when I inserrt the Component under the last Image, then I can not anchor it under the image...
so example:
ListView { anchors.fill: parent model: 10 delegate: delegateComponent contentHeight: 5000 // or later I can recalculate in whatever way Image { id: myImage anchors.top: parent.top anchors.left: parent.left anchors.right: parent.right height: 100 } Text { id: myText anchors.top: myImage.bottom anchors.left: parent.left anchors.right: parent.right height: contentHeight text: "bla bla bla" } Component { // this to be repeated 10 times according to ListView model id: delegateComponent // here i need to anchor the top of this Component to bottom of myText Label { id: myLabel text: "some text for index " + index } } }
so basicaly Image, Text and Component (and repeated Label according to ListView model inside this Component) to be inside the content area for ListView...
the hell I have no idea how to achieve this...
Please guide me :)
-
This appears to be a ListView.header.
As for why the code above doesn't work, the ListView is the
parent
referred to by the Image and Text anchors. The intended target appears to be the ListView's contentItem. Even with that change, it likely won't work with the view's placement of delegates in the same area. -