diff options
Diffstat (limited to 'examples/declarative/scrollbar')
-rw-r--r-- | examples/declarative/scrollbar/ScrollBar.qml | 12 | ||||
-rw-r--r-- | examples/declarative/scrollbar/display.qml | 34 |
2 files changed, 23 insertions, 23 deletions
diff --git a/examples/declarative/scrollbar/ScrollBar.qml b/examples/declarative/scrollbar/ScrollBar.qml index b42563d..802b537 100644 --- a/examples/declarative/scrollbar/ScrollBar.qml +++ b/examples/declarative/scrollbar/ScrollBar.qml @@ -1,7 +1,7 @@ import Qt 4.6 Item { - id: ScrollBar + id: scrollBar // The properties that define the scrollbar's state. // position and pageSize are in the range 0.0 - 1.0. They are relative to the // height of the page, i.e. a pageSize of 0.5 means that you can see 50% @@ -13,7 +13,7 @@ Item { // A light, semi-transparent background Rectangle { - id: Background + id: background radius: orientation == 'Vertical' ? (width/2 - 1) : (height/2 - 1) color: "white"; opacity: 0.3 anchors.fill: parent @@ -23,9 +23,9 @@ Item { opacity: 0.7 color: "black" radius: orientation == 'Vertical' ? (width/2 - 1) : (height/2 - 1) - x: orientation == 'Vertical' ? 1 : (ScrollBar.position * (ScrollBar.width-2) + 1) - y: orientation == 'Vertical' ? (ScrollBar.position * (ScrollBar.height-2) + 1) : 1 - width: orientation == 'Vertical' ? (parent.width-2) : (ScrollBar.pageSize * (ScrollBar.width-2)) - height: orientation == 'Vertical' ? (ScrollBar.pageSize * (ScrollBar.height-2)) : (parent.height-2) + x: orientation == 'Vertical' ? 1 : (scrollBar.position * (scrollBar.width-2) + 1) + y: orientation == 'Vertical' ? (scrollBar.position * (scrollBar.height-2) + 1) : 1 + width: orientation == 'Vertical' ? (parent.width-2) : (scrollBar.pageSize * (scrollBar.width-2)) + height: orientation == 'Vertical' ? (scrollBar.pageSize * (scrollBar.height-2)) : (parent.height-2) } } diff --git a/examples/declarative/scrollbar/display.qml b/examples/declarative/scrollbar/display.qml index 0180bda..536a8b7 100644 --- a/examples/declarative/scrollbar/display.qml +++ b/examples/declarative/scrollbar/display.qml @@ -5,21 +5,21 @@ Rectangle { height: 480 // Create a flickable to view a large image. Flickable { - id: View + id: view anchors.fill: parent Image { - id: Picture + id: picture source: "pics/niagara_falls.jpg" } - viewportWidth: Picture.width - viewportHeight: Picture.height + viewportWidth: picture.width + viewportHeight: picture.height // Only show the scrollbars when the view is moving. states: [ State { name: "ShowBars" - when: View.moving - PropertyChanges { target: SBV; opacity: 1 } - PropertyChanges { target: SBH; opacity: 1 } + when: view.moving + PropertyChanges { target: verticalScrollBar; opacity: 1 } + PropertyChanges { target: horizontalScrollBar; opacity: 1 } } ] transitions: [ @@ -35,23 +35,23 @@ Rectangle { } // Attach scrollbars to the right and bottom edges of the view. ScrollBar { - id: SBV + id: verticalScrollBar opacity: 0 orientation: "Vertical" - position: View.visibleArea.yPosition - pageSize: View.visibleArea.heightRatio + position: view.visibleArea.yPosition + pageSize: view.visibleArea.heightRatio width: 12 - height: View.height-12 - anchors.right: View.right + height: view.height-12 + anchors.right: view.right } ScrollBar { - id: SBH + id: horizontalScrollBar opacity: 0 orientation: "Horizontal" - position: View.visibleArea.xPosition - pageSize: View.visibleArea.widthRatio + position: view.visibleArea.xPosition + pageSize: view.visibleArea.widthRatio height: 12 - width: View.width-12 - anchors.bottom: View.bottom + width: view.width-12 + anchors.bottom: view.bottom } } |