I have qml ListView and inside it, I load My ListModel. My delegate component is a rectangle that holds a Text component. the Problem is when I scroll the ListView some alphabet like 'H' step out of the defined Rectangle. My defined rectangle has a round edge (radius), and the alphabet appears on the rounded edge. Is there any solution to it?
The code sample just is a summary of the main code, imagine the list view is the whole alphabet.
blabla.qml
Rectangle{
anchors.fill: parent
color: "#141414"
// Rect to keep listView component
Rectangle {
id: rectList
anchors.centerIn: parent
width: 200
height: 400
radius: 10
ListModel{
id: bla
ListElement{name: "A"} ....}
Component{
id: delegateComponent
Rectangle{
id: rectListView
width: rectList.width
height: 30// txt.implicitHeight //removed implicitHeight
color: "transparent"
// radius: 10
z: -1
readonly property ListView __lv: ListView.view // read only property for saving model current index
Text {
id: txt
property string __longString
anchors.fill: rectListView
anchors.left: rectListView.left
anchors.bottomMargin: 5
width: rectListView.width
height: rectListView.height
text: model.name
}
}
ListView{
id: lv
model: listModel
delegate: delegateComponent
anchors.fill: parent
anchors.centerIn: parent
focus: true
clip: true
cacheBuffer: 5000
spacing: 15
}
UPDATE: