summaryrefslogtreecommitdiffstats
path: root/examples/declarative/listview
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2009-10-28 23:03:06 (GMT)
committerMartin Jones <martin.jones@nokia.com>2009-10-28 23:03:06 (GMT)
commit6c548e21f48b07d55187952ff21cbbc23fdd3927 (patch)
treedb284dc4f43da30a80f56fe54adad1e5c891e108 /examples/declarative/listview
parent6849c2f7f7ed0d024b8d8fd506fe59405c636082 (diff)
downloadQt-6c548e21f48b07d55187952ff21cbbc23fdd3927.zip
Qt-6c548e21f48b07d55187952ff21cbbc23fdd3927.tar.gz
Qt-6c548e21f48b07d55187952ff21cbbc23fdd3927.tar.bz2
Update viewport size when items are added/removed/resized.
Diffstat (limited to 'examples/declarative/listview')
-rw-r--r--examples/declarative/listview/dynamic.qml22
1 files changed, 22 insertions, 0 deletions
diff --git a/examples/declarative/listview/dynamic.qml b/examples/declarative/listview/dynamic.qml
index 78346f3..2607527 100644
--- a/examples/declarative/listview/dynamic.qml
+++ b/examples/declarative/listview/dynamic.qml
@@ -1,5 +1,6 @@
import Qt 4.6
import "content"
+import "../scrollbar"
Rectangle {
width: 640; height: 480
@@ -99,10 +100,31 @@ Rectangle {
}
ListView {
+ id: view
model: fruitModel; delegate: fruitDelegate
anchors { top: parent.top; left: parent.left; right: parent.right; bottom: buttons.top }
}
+ // Attach scrollbar to the right edge of the view.
+ ScrollBar {
+ id: verticalScrollBar
+ opacity: 0
+ orientation: "Vertical"
+ position: view.visibleArea.yPosition
+ pageSize: view.visibleArea.heightRatio
+ width: 8
+ height: view.height
+ anchors.right: view.right
+ // Only show the scrollbar when the view is moving.
+ states: [
+ State {
+ name: "ShowBars"; when: view.moving
+ PropertyChanges { target: verticalScrollBar; opacity: 1 }
+ }
+ ]
+ transitions: [ Transition { NumberAnimation { properties: "opacity"; duration: 400 } } ]
+ }
+
Row {
x: 8; width: childrenRect.width
height: childrenRect.height