aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquicklistview/data
diff options
context:
space:
mode:
authorRobin Burchell <robin.burchell@theqtcompany.com>2015-12-22 00:06:06 +0100
committerRobin Burchell <robin.burchell@viroteck.net>2016-01-15 11:04:22 +0000
commit96f1bb07eb420d5e01f1ea0273c7c9223adaf504 (patch)
tree5e13b286c83a8b557c72fe9d56ab110f09d3bfbd /tests/auto/quick/qquicklistview/data
parentf4fb1ff1883ae6c9bafad41343eae4dd7fd51e55 (diff)
QQuickItemView: Take sticky header/footer into account for positionViewAtIndex().
When using an overlaid header or footer, we must adjust the position we come up with by the appropriate size in order to end up at the correct place. Change-Id: I218b9aef7fdf37f56ffb63dc395f97045b55a186 Task-number: QTBUG-50097 Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
Diffstat (limited to 'tests/auto/quick/qquicklistview/data')
-rw-r--r--tests/auto/quick/qquicklistview/data/qtbug50097.qml47
1 files changed, 47 insertions, 0 deletions
diff --git a/tests/auto/quick/qquicklistview/data/qtbug50097.qml b/tests/auto/quick/qquicklistview/data/qtbug50097.qml
new file mode 100644
index 0000000000..24d506b804
--- /dev/null
+++ b/tests/auto/quick/qquicklistview/data/qtbug50097.qml
@@ -0,0 +1,47 @@
+import QtQuick 2.6
+
+ListView {
+ id: lv
+
+ // How many rows per page
+ property int pageSize: 5
+
+ // The current page number
+ property int currentPage: 1
+
+ // How large a single item is
+ property int itemSize: 100
+
+ // Arbitrary
+ property int totalPages: 5
+
+ height: itemSize * pageSize // display one full page at a time
+ width: 500 // arbitrary.
+ model: pageSize * totalPages
+ delegate: Text {
+ height: itemSize
+ text: "Item " + (index + 1) + " of " + lv.count
+ }
+
+ // contentY should be < 0 to account for header visibility
+ onContentYChanged: console.log(contentY)
+
+ headerPositioning: ListView.OverlayHeader
+ header: Rectangle {
+ height: itemSize
+ width: 500
+ z: 1000
+ visible: false
+ color: "black"
+
+ Text {
+ anchors.centerIn: parent
+ color: "red"
+ text: "List header"
+ }
+ }
+
+ onCurrentPageChanged: {
+ lv.positionViewAtIndex((currentPage - 1) * pageSize, ListView.Beginning);
+ }
+}