Lomiri
ButtonPrompt.qml
1 import QtQuick 2.4
2 import Lomiri.Components 1.3
3 import "../Components"
4 
5 FocusScope {
6  id: root
7  objectName: "promptButton"
8 
9  property alias text: buttonLabel.text
10  property alias interactive: root.enabled
11  property bool isSecret
12  property bool loginError: false
13  property bool hasKeyboard: false
14  property string enteredText: ""
15 
16  signal clicked()
17  signal canceled()
18  signal accepted(string response)
19 
20  Keys.onSpacePressed: clicked();
21  Keys.onReturnPressed: clicked();
22  Keys.onEnterPressed: clicked();
23 
24  anchors.fill: parent
25 
26  activeFocusOnTab: true
27 
28  Rectangle {
29  anchors.fill: parent
30  radius: units.gu(0.5)
31  color: "#7A111111"
32  Behavior on border.color {
33  ColorAnimation{}
34  }
35  border {
36  color: root.loginError ? theme.palette.normal.negative : theme.palette.normal.raisedSecondaryText
37  width: root.loginError ? units.dp(2): units.dp(1)
38  }
39  }
40 
41  MouseArea {
42  anchors.fill: parent
43  onClicked: parent.clicked();
44  }
45 
46  Label {
47  id: buttonLabel
48  anchors.centerIn: parent
49  color: theme.palette.normal.raisedSecondaryText
50  }
51 }