qtmobility/examples/qmlcontacts/contents/MediaButton.qml
changeset 1 2b40d63a9c3d
child 14 6fbed849b4f4
equal deleted inserted replaced
0:cfcbf08528c4 1:2b40d63a9c3d
       
     1 import Qt 4.6
       
     2 
       
     3 Item {
       
     4     property var text
       
     5     signal clicked
       
     6 
       
     7     id: container
       
     8     Image {
       
     9         id: normal
       
    10         source: "pics/button.png"
       
    11     }
       
    12     Image {
       
    13         id: pressed
       
    14         source: "pics/button-pressed.png"
       
    15         opacity: 0
       
    16     }
       
    17     MouseRegion {
       
    18         id: clickRegion
       
    19         anchors.fill: normal
       
    20         onClicked: { container.clicked(); }
       
    21     }
       
    22     Text {
       
    23         font.bold: true
       
    24         color: "white"
       
    25         anchors.centerIn: normal
       
    26         text: container.text
       
    27     }
       
    28     width: normal.width
       
    29 
       
    30     states: State {
       
    31         name: "Pressed"
       
    32         when: clickRegion.pressed == true
       
    33         PropertyChanges { target: pressed; opacity: 1 }
       
    34     }
       
    35 }