Is there a way to hide the elements which past the visible view in ListView?
At the moment they go pass the header item and over another item before the header.
ListView {
id: searchList
anchors.top: searchFieldBottomBorder.bottom
anchors.topMargin: 20
anchors.left: parent.left
anchors.leftMargin: (parent.width - width) / 2
width: searchField.width
height: (body.height - title.height - searchField.height - 100)
cacheBuffer: 0
header: Rectangle {
height: 50
width: searchList.width
color: "transparent"
Text {
text: "Select Location"
color: "#ffffff"
font.pixelSize: 18
anchors.fill: parent
verticalAlignment: Qt.AlignVCenter
}
}
headerPositioning: ListView.OverlayHeader
delegate: Rectangle {
height: 40
width: searchList.width
color: "transparent"
Text {
text: modelData
color: "#ffffff"
font.pixelSize: 18
anchors.fill: parent
verticalAlignment: Qt.AlignVCenter
}
MouseArea {
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
}
}
}
ListView {
id: searchList
anchors.top: searchFieldBottomBorder.bottom
anchors.topMargin: 20
anchors.left: parent.left
anchors.leftMargin: (parent.width - width) / 2
width: searchField.width
height: (body.height - title.height - searchField.height - 100)
cacheBuffer: 0
header: Rectangle {
height: 50
width: searchList.width
color: "transparent"
Text {
text: "Select Location"
color: "#ffffff"
font.pixelSize: 18
anchors.fill: parent
verticalAlignment: Qt.AlignVCenter
}
}
headerPositioning: ListView.OverlayHeader
delegate: Rectangle {
height: 40
width: searchList.width
color: "transparent"
Text {
text: modelData
color: "#ffffff"
font.pixelSize: 18
anchors.fill: parent
verticalAlignment: Qt.AlignVCenter
}
MouseArea {
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
}
}
}
To copy to clipboard, switch view to plain text mode
Qt version: 5.6.2
Bookmarks