ListView items overflowing up and down

Hello,
I tried to place a SilicaListView in a Rectangle, it works but the items of the list overflow the limits of the rectangle, when scrolling up or downward. Same thing with ListView. I tried this method in order to place, later, two flickable lists in the same page (one at the top and one at the bottom of the page).
Is there a way to fix this or to do it in another way?
Thank you.
The code is:
Page {
Column {
width: parent.width
spacing: Theme.paddingMedium
Label {
text: “This is a label”
}
Rectangle {
id: rectangle
width: parent.width - 2*Theme.paddingMedium
x: Theme.paddingMedium
height:450
border.color: Theme.secondaryColor
color: “transparent”
SilicaListView {
width: parent.width
height: rectangle.height
model: ListModel {
ListElement { name: “object1”}
ListElement { name: “object2”}
ListElement { name: “object3”}
ListElement { name: “object4”}
ListElement { name: “object5”}
ListElement { name: “object6”}
ListElement { name: “object7”}
ListElement { name: “object8”}
ListElement { name: “object9”}
ListElement { name: “object10”}
ListElement { name: “object11”}
}
delegate: Item {
width: parent.width
height: Theme.itemSizeExtraSmall
Label {
text: name
font.pixelSize: Theme.fontSizeMedium
}
}
}
}
}
}

Try to set clip property of the rectangle to true. See https://doc.qt.io/qt-5/qml-qtquick-item.html#clip-prop

1 Like

Thank you verty much karry, it works fine! Problem solved and knowledge increased.

Sorry for resurrecting this thread, I just came by it looking for something else so others might too.

I tried this method in order to place, later, two flickable lists in the same page (one at the top and one at the bottom of the page).
Is there a way to fix this or to do it in another way?

Silica.ColumnView seems to be made for this.

SilicaFlickable {
    PageHeader {}
    SectionHeader {}
    ColumnView {}
    SectionHeader {}
    ColumnView {}
}
1 Like

Somehow I get a sense that recursion is in play! Quick, get @attah! there is hope yet!

Can’t you just anchor the list(views)s to their respective halves of the enclosing component?
(as opposed to unspecified, or fill)
Or maybe i’m missing the point…