tests/auto/declarative/qmlvisual/qdeclarativeflickable/flickable-vertical.qml
branchGCC_SURGE
changeset 31 5daf16870df6
parent 30 5dc02b23752f
equal deleted inserted replaced
27:93b982ccede2 31:5daf16870df6
       
     1 import Qt 4.7
       
     2 
       
     3 Rectangle {
       
     4     color: "lightSteelBlue"
       
     5     width: 300; height: 600
       
     6 
       
     7     ListModel {
       
     8         id: list
       
     9         ListElement { dayColor: "steelblue" }
       
    10         ListElement { dayColor: "blue" }
       
    11         ListElement { dayColor: "yellow" }
       
    12         ListElement { dayColor: "purple" }
       
    13         ListElement { dayColor: "red" }
       
    14         ListElement { dayColor: "green" }
       
    15         ListElement { dayColor: "orange" }
       
    16     }
       
    17 
       
    18     Flickable {
       
    19         id: flick
       
    20         height: parent.height-50
       
    21         width: parent.width; contentHeight: column.height
       
    22 
       
    23         Column {
       
    24             id: column
       
    25             Repeater {
       
    26                 model: list
       
    27                 Rectangle { width: 300; height: 200; color: mr.pressed ? "black" : dayColor
       
    28                     MouseArea {
       
    29                         id: mr
       
    30                         anchors.fill: parent
       
    31                     }
       
    32                 }
       
    33             }
       
    34         }
       
    35         clip: true
       
    36     }
       
    37     Rectangle {
       
    38         radius: 3
       
    39         x: flick.width-8
       
    40         width: 8
       
    41         y: flick.visibleArea.yPosition * flick.height
       
    42         height: flick.visibleArea.heightRatio * flick.height
       
    43     }
       
    44 
       
    45     // click to toggle interactive flag
       
    46     Rectangle {
       
    47         width: 64
       
    48         height: 48
       
    49         y: parent.height - 50
       
    50         color: "red"
       
    51         MouseArea {
       
    52             anchors.fill: parent
       
    53             onClicked: flick.interactive = flick.interactive ? false : true
       
    54         }
       
    55     }
       
    56 
       
    57     // click to toggle click delay
       
    58     Rectangle {
       
    59         width: 64
       
    60         height: 48
       
    61         x: 66
       
    62         y: parent.height - 50
       
    63         color: "green"
       
    64         MouseArea {
       
    65             anchors.fill: parent
       
    66             onClicked: flick.pressDelay = flick.pressDelay > 0 ? 0 : 500
       
    67         }
       
    68     }
       
    69 
       
    70     // click to toggle overshoot
       
    71     Rectangle {
       
    72         width: 64
       
    73         height: 48
       
    74         x: 130
       
    75         y: parent.height - 50
       
    76         color: "yellow"
       
    77         MouseArea {
       
    78             anchors.fill: parent
       
    79             onClicked: flick.boundsBehavior = flick.boundsBehavior == Flickable.StopAtBounds ? Flickable.DragAndOvershootBounds : Flickable.StopAtBounds
       
    80         }
       
    81     }
       
    82 
       
    83     Rectangle {
       
    84         width: Math.abs(flick.verticalVelocity)/100
       
    85         height: 50
       
    86         x: 200
       
    87         y: parent.height - 50
       
    88         color: blue
       
    89     }
       
    90 }