There is a QML application showing the list of items by means of ListView component:
listview.jpg
When ListView is scrolled its content often goes beyond the borders:
listview-overscrolled.jpg
I thought it could be adjusted by setting boundsBehavior to Flickable.StopAtBounds, but although I have done that, it still behaves like it is shown above.
The code is quite simple:
import QtQuick 2.0
import QtQuick.Controls 2.0
Rectangle
{
color: "gray"
Rectangle
{
color: "blue"
border.color: "orange"
anchors { fill: parent; margins: 50 }
ListView
{
anchors { fill: parent; margins: parent.border.width }
boundsBehavior: Flickable.StopAtBounds
//snapMode: ListView.SnapOneItem
//snapMode: ListView.SnapToItem
//preferredHighlightBegin: 0
//preferredHighlightEnd: 0
//highlightRangeMode: ListView.StrictlyEnforceRange
//cacheBuffer: 200
model: [ "What", "a", "hell", "is", "wrong", "with", "you?"]
delegate: Item
{
height: 150
width: parent.width
Rectangle
{
anchors.fill: parent
color: "lightgray"
Text { text: modelData; font.pixelSize: 50 }
}
} // delegate
//ScrollBar.vertical: ScrollBar {}
} // ListView
} // Rectangle (listview border)
} // Rectangle (main)
import QtQuick 2.0
import QtQuick.Controls 2.0
Rectangle
{
color: "gray"
Rectangle
{
color: "blue"
border.color: "orange"
anchors { fill: parent; margins: 50 }
ListView
{
anchors { fill: parent; margins: parent.border.width }
boundsBehavior: Flickable.StopAtBounds
//snapMode: ListView.SnapOneItem
//snapMode: ListView.SnapToItem
//preferredHighlightBegin: 0
//preferredHighlightEnd: 0
//highlightRangeMode: ListView.StrictlyEnforceRange
//cacheBuffer: 200
model: [ "What", "a", "hell", "is", "wrong", "with", "you?"]
delegate: Item
{
height: 150
width: parent.width
Rectangle
{
anchors.fill: parent
color: "lightgray"
Text { text: modelData; font.pixelSize: 50 }
}
} // delegate
//ScrollBar.vertical: ScrollBar {}
} // ListView
} // Rectangle (listview border)
} // Rectangle (main)
To copy to clipboard, switch view to plain text mode
Any ideas?
Bookmarks