Skip to content

Instantly share code, notes, and snippets.

@rburchell
Created July 23, 2017 18:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rburchell/3026d3229d4211f71b947e3f9eee6d9f to your computer and use it in GitHub Desktop.
Save rburchell/3026d3229d4211f71b947e3f9eee6d9f to your computer and use it in GitHub Desktop.
artificial scrolling GC testcase
import QtQuick 2.6
ListView {
id: lv
width: 300
height: 1200
model: 10000
delegate: Rectangle {
width: ListView.view.width
height: 50
color: index % 2 == 0 ? "red" : "blue"
opacity: 0.2
Row {
anchors.fill: parent
Image {
source: "pony0.jpg"
height: parent.height
width: 30
}
Image {
source: "pony1.jpg"
height: parent.height
width: 30
}
Image {
source: "pony2.jpg"
height: parent.height
width: 30
}
}
}
// uncomment the below to make it super super artificial (it'll scroll the
// whole ListView repeatedly).
/*
NumberAnimation {
id: scrollDown
target: lv
property: "contentY"
to: lv.contentHeight - lv.height
duration: 100
onRunningChanged: {
if (!running) {
scrollUp.start()
}
}
}
NumberAnimation {
id: scrollUp
target: lv
property: "contentY"
to: 0
duration: 100
onRunningChanged: {
if (!running) {
scrollDown.start()
}
}
}
Component.onCompleted: {
scrollDown.start()
}*/
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment