123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- /*
- * Copyright (c) 2010 Nokia Corporation.
- */
- import Qt 4.7
- Item {
- width: 30
- height: 30
- smooth: true
- property string buttonPath // for example "qrc:/gfx/exit.png"
- property int buttonId: 0
- signal btnClicked(int buttonId)
- property bool animationEnabled: true
- Image {
- id: image
- anchors.fill: parent
- source: buttonPath
- fillMode: Image.PreserveAspectFit
- smooth: true
- }
- SequentialAnimation {
- id:anim
- PropertyAction { target: image; property: "scale"; value:"0.7"}
- PauseAnimation { duration: 200 }
- PropertyAction { target: image; property: "scale"; value:"1.0"}
- }
- Timer {
- id: buttonPressedTimer
- interval: 300; running: false; repeat: false
- onTriggered: btnClicked(buttonId)
- }
- MouseArea {
- anchors.fill: parent
- onPressed: {
- if (animationEnabled && !anim.running) {
- anim.restart()
- }
- buttonPressedTimer.restart()
- }
- }
- }
|