tests/auto/declarative/qdeclarativepathview/data/propertychanges.qml
changeset 30 5dc02b23752f
equal deleted inserted replaced
29:b72c6db6890b 30:5dc02b23752f
       
     1 import Qt 4.7
       
     2 
       
     3 Rectangle {
       
     4     width: 350; height: 220; color: "white"
       
     5     Component {
       
     6         id: myDelegate
       
     7         Item {
       
     8             id: wrapper
       
     9             width: 180; height: 40; 
       
    10             opacity: PathView.opacity
       
    11             Column {
       
    12                 x: 5; y: 5
       
    13                 Text { text: '<b>Name:</b> ' + name }
       
    14                 Text { text: '<b>Number:</b> ' + number }
       
    15             }
       
    16         }
       
    17     }
       
    18 
       
    19     PathView {
       
    20         preferredHighlightBegin: 0.1
       
    21         preferredHighlightEnd: 0.1
       
    22         dragMargin: 5.0
       
    23         id: pathView
       
    24         objectName: "pathView"
       
    25         anchors.fill: parent
       
    26         model: listModel
       
    27         delegate: myDelegate
       
    28         focus: true
       
    29         path: Path {
       
    30             id: myPath
       
    31             objectName: "path"
       
    32             startX: 220; startY: 200
       
    33             PathAttribute { name: "opacity"; value: 1.0; objectName: "pathAttribute"; }
       
    34             PathQuad { x: 220; y: 25; controlX: 260; controlY: 75 }
       
    35             PathAttribute { name: "opacity"; value: 0.3 }
       
    36             PathQuad { x: 220; y: 200; controlX: -20; controlY: 75 }
       
    37         }
       
    38         Timer {
       
    39             interval: 2000; running: true; repeat: true
       
    40             onTriggered: {
       
    41                 if (pathView.path == alternatePath)
       
    42                     pathView.path = myPath;
       
    43                 else
       
    44                     pathView.path = alternatePath;
       
    45             }
       
    46         }
       
    47     }
       
    48 
       
    49     data:[  
       
    50     ListModel {
       
    51         id: listModel
       
    52         ListElement {
       
    53             name: "Bill Smith"
       
    54             number: "555 3264"
       
    55         }
       
    56         ListElement {
       
    57             name: "John Brown"
       
    58             number: "555 8426"
       
    59         }
       
    60         ListElement {
       
    61             name: "Sam Wise"
       
    62             number: "555 0473"
       
    63         }
       
    64         ListElement {
       
    65             name: "Bill Smith"
       
    66             number: "555 3264"
       
    67         }
       
    68         ListElement {
       
    69             name: "John Brown"
       
    70             number: "555 8426"
       
    71         }
       
    72         ListElement {
       
    73             name: "Sam Wise"
       
    74             number: "555 0473"
       
    75         }
       
    76         ListElement {
       
    77             name: "Bill Smith"
       
    78             number: "555 3264"
       
    79         }
       
    80         ListElement {
       
    81             name: "John Brown"
       
    82             number: "555 8426"
       
    83         }
       
    84         ListElement {
       
    85             name: "Sam Wise"
       
    86             number: "555 0473"
       
    87         }
       
    88     },
       
    89     ListModel {
       
    90         objectName: "alternateModel"
       
    91         ListElement {
       
    92             name: "Jack"
       
    93             number: "555 8426"
       
    94         }
       
    95         ListElement {
       
    96             name: "Mary"
       
    97             number: "555 3264"
       
    98         }
       
    99     },
       
   100     Path {
       
   101         id: alternatePath
       
   102         objectName: "alternatePath"
       
   103         startX: 100; startY: 40
       
   104         PathAttribute { name: "opacity"; value: 0.0 }
       
   105         PathLine { x: 100; y: 160 }
       
   106         PathAttribute { name: "opacity"; value: 0.2 }
       
   107         PathLine { x: 300; y: 160 }
       
   108         PathAttribute { name: "opacity"; value: 0.0 }
       
   109         PathLine { x: 300; y: 40 }
       
   110         PathAttribute { name: "opacity"; value: 0.2 }
       
   111         PathLine { x: 100; y: 40 }
       
   112     }
       
   113     ]
       
   114 }
       
   115 
       
   116