demos/declarative/webbrowser/content/Button.qml
changeset 33 3e2da88830cd
parent 30 5dc02b23752f
equal deleted inserted replaced
30:5dc02b23752f 33:3e2da88830cd
    43 
    43 
    44 Item {
    44 Item {
    45     property alias image: icon.source
    45     property alias image: icon.source
    46     property variant action
    46     property variant action
    47 
    47 
       
    48     signal clicked
       
    49 
    48     width: 40; height: parent.height
    50     width: 40; height: parent.height
    49 
    51 
    50     Image {
    52     Image {
    51         id: icon; anchors.centerIn: parent
    53         id: icon; anchors.centerIn: parent
    52         opacity: action.enabled ? 1.0 : 0.4
    54         opacity: if (action != undefined) { action.enabled ? 1.0 : 0.4 } else 1
    53     }
    55     }
    54 
    56 
    55     MouseArea {
    57     MouseArea {
    56         anchors { fill: parent; topMargin: -10; bottomMargin: -10 }
    58         anchors { fill: parent; topMargin: -10; bottomMargin: -10 }
    57         onClicked: action.trigger()
    59         onClicked: {
       
    60             if (action != undefined)
       
    61                 action.trigger()
       
    62             parent.clicked()
       
    63         }
    58     }
    64     }
    59 }
    65 }