Solved Spacing in ListView after header / before footer
-
I everyone,
it seems to me that if I have a list with a spacing, this spacing is not applied between the last element and the footer. How can I change this?
I already tried in the footer anchors.marginLeft: 10,bit it diddn't helpListView { id: pictureListView Layout.preferredHeight: 100 Layout.fillWidth: true orientation: ListView.Horizontal spacing: 10 model: 4 delegate: Rectangle { height: 100; width: 100 color: "transparent" border.color: "blue" } footer: Rectangle { anchors.leftMargin: 10 height: 100; width: 100 Image { anchors.fill: parent source: "image://icons/add" } color: "transparent" border.color: "blue" } } }
-
@Leon_2001
anchros.leftMargin is only applied when you also set anchors.left
you can wrap your current footer item in an Item and add a margin in there -
Thank you very much, it worked!
I still fell like there should be a cleaner solution. Maybe provided by ListView itself? In fact, I actually ecspected this spacing to be default. Mayb there could be a property like bool applySpacingToFooter?
What do you think about it? -
@Leon_2001 said in Spacing in ListView after header / before footer:
What do you think about it?
well spacings belong between items. and your special usecase can be easily worked around.