~mterry/unity8/less-ubuntucolors

« back to all changes in this revision

Viewing changes to qml/Components/PinPadButton.qml

  • Committer: Michael Zanetti
  • Date: 2016-05-02 08:15:14 UTC
  • mfrom: (2325.1.50 unity8)
  • Revision ID: michael.zanetti@canonical.com-20160502081514-9cnbi0v1sqjkhym4
merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
import QtQuick 2.4
18
18
import Ubuntu.Components 1.3
19
19
 
20
 
AbstractButton {
 
20
Item {
21
21
    id: root
22
22
    opacity: enabled ? 1 : 0.6
23
23
 
25
25
    property string iconName
26
26
    property color foregroundColor: "#000000"
27
27
 
 
28
    signal clicked();
 
29
 
28
30
    UbuntuShape {
29
31
        anchors.fill: parent
30
 
        opacity: root.pressed ? 1 : 0
 
32
        opacity: mouseArea.pressed ? 1 : 0
31
33
        Behavior on opacity {
32
34
            UbuntuNumberAnimation {}
33
35
        }
60
62
            UbuntuNumberAnimation { duration: UbuntuAnimation.SlowDuration }
61
63
        }
62
64
    }
 
65
 
 
66
    MouseArea {
 
67
        id: mouseArea
 
68
        anchors.fill: parent
 
69
 
 
70
        // Intentionally using onReleased here to increase the robustness against
 
71
        // sloppy presses. This often happens when entering a pin very quickly and
 
72
        // the numbers for the pin are far apart.
 
73
        onReleased: {
 
74
            Haptics.play();
 
75
            root.clicked();
 
76
        }
 
77
    }
63
78
}