AusweisApp2/resources/qml/Governikus/Global/GTextField.qml

41 lines
853 B
QML
Raw Normal View History

2017-07-03 09:33:28 +02:00
import QtQuick 2.7
import QtQuick.Controls 1.4
2017-12-20 14:54:05 +01:00
import QtQuick.Controls.Styles 1.4
2017-07-03 09:33:28 +02:00
2017-12-20 14:54:05 +01:00
import "Utils.js" as Utils
import "." as Gov
2017-07-03 09:33:28 +02:00
Item {
property alias text: field.text
property alias displayText: field.displayText
property alias echoMode: field.echoMode
signal accepted
property bool valid: true
height: Utils.dp(24)
width: Utils.dp(240)
Rectangle {
radius: Utils.dp(6)
anchors.fill: parent
2017-12-20 14:54:05 +01:00
border.color: Gov.Constants.red
color: enabled ? "white" : Gov.Constants.grey
2017-07-03 09:33:28 +02:00
border.width: valid ? 0 : Utils.dp(2)
}
TextField {
id: field
anchors.fill: parent
anchors.leftMargin: Utils.dp(6)
anchors.rightMargin: Utils.dp(6)
2017-12-20 14:54:05 +01:00
font.pixelSize: Gov.Constants.normal_font_size
2017-07-03 09:33:28 +02:00
onAccepted: parent.accepted()
2017-12-20 14:54:05 +01:00
style: TextFieldStyle {
background: Rectangle {}
}
2017-07-03 09:33:28 +02:00
}
onActiveFocusChanged: if (focus) field.forceActiveFocus()
}