b13ab841c305e6da65c814e58088a5c87bcecdcf
[ubi] / qml / ubi / components / TextField.qml
1 import QtQuick 1.0
2
3 Rectangle {
4     id: root
5
6     property alias text : input.text
7     property alias echoMode : input.echoMode
8     property alias inputFocus: input.focus
9     property alias placeholderText: placeholder.text
10
11     signal textChanged
12
13     height: 50
14
15     color:  "white"
16     border.width: 3
17     border.color: input.activeFocus ? "black" : "grey"
18
19     TextInput {
20         id: input
21
22         anchors { fill: parent; leftMargin: 6; rightMargin: 6; topMargin: 6; bottomMargin: 6 }
23         font.pixelSize: 30
24         selectByMouse: true
25         selectionColor: "gray"
26         onTextChanged: root.textChanged()
27
28         Keys.onReturnPressed: {
29             closeSoftwareInputPanel()
30             dummy.focus = true
31         }
32
33     }
34     Item { id: dummy }
35
36     Text {
37         id: placeholder
38
39         anchors { fill: parent; leftMargin: 6; rightMargin: 6; topMargin: 6; bottomMargin: 6 }
40         font.pixelSize: input.font.pixelSize
41         clip: true
42         visible: (!input.activeFocus) && (input.text == "")
43         color: "gray"
44         font.italic: true
45     }
46
47 }