qtmobility/examples/declarative-sfw-notes/content/Button.qml
changeset 5 453da2cfceef
child 14 6fbed849b4f4
equal deleted inserted replaced
4:90517678cc4f 5:453da2cfceef
       
     1 import Qt 4.7
       
     2 
       
     3 Rectangle {
       
     4     id: container
       
     5 
       
     6     signal clicked
       
     7     property string image: ""
       
     8     property string text: ""
       
     9 
       
    10     color: activePalette.button; smooth: true
       
    11     border.width: 1; border.color: Qt.darker(activePalette.button); radius: 8;
       
    12 
       
    13     gradient: Gradient {
       
    14         GradientStop {
       
    15             id: topGrad; position: 0.0
       
    16             color :if (mr.pressed) { activePalette.dark } else { activePalette.light } }
       
    17         GradientStop { position: 1.0; color: activePalette.button }
       
    18     }
       
    19 
       
    20     Image {
       
    21         id: imgItem;
       
    22         smooth: true
       
    23         width: 16; height: 16;
       
    24         source: container.image; anchors.centerIn: container
       
    25     }
       
    26 
       
    27     MouseArea { id: mr; anchors.fill: parent; onClicked: container.clicked() }
       
    28 
       
    29     Text {
       
    30         id: txtItem; text: container.text; anchors.centerIn: container; color: activePalette.buttonText
       
    31     }
       
    32 }