Initial commit
[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
29     Text {
30         id: placeholder
31
32         anchors { fill: parent; leftMargin: 6; rightMargin: 6; topMargin: 6; bottomMargin: 6 }
33         font.pixelSize: input.font.pixelSize
34         clip: true
35         visible: (!input.activeFocus) && (input.text == "")
36         color: "gray"
37         font.italic: true
38     }
39
40 }