feat: add Input to Login screen and enable otherProps for the Input
This commit is contained in:
parent
c29160fff7
commit
545bb751c1
|
@ -128,22 +128,20 @@ SwipeView {
|
|||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
color: "#EEEEEE"
|
||||
Input {
|
||||
id: txtPassword
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.rightMargin: Theme.padding
|
||||
anchors.leftMargin: Theme.padding
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.centerIn: parent
|
||||
height: 32
|
||||
width: parent.width - 40
|
||||
TextInput {
|
||||
id: txtPassword
|
||||
anchors.fill: parent
|
||||
focus: true
|
||||
echoMode: TextInput.Password
|
||||
selectByMouse: true
|
||||
Keys.onReturnPressed: {
|
||||
submitBtn.clicked()
|
||||
}
|
||||
otherProps: {
|
||||
this.textField.focus = true
|
||||
this.textField.focus
|
||||
this.textField.echoMode = TextInput.Password
|
||||
}
|
||||
Keys.onReturnPressed: {
|
||||
submitBtn.clicked()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -154,8 +152,8 @@ SwipeView {
|
|||
icon: StandardIcon.Critical
|
||||
standardButtons: StandardButton.Ok
|
||||
onAccepted: {
|
||||
txtPassword.clear()
|
||||
txtPassword.focus = true
|
||||
txtPassword.textField.clear()
|
||||
txtPassword.textField.focus = true
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -177,7 +175,7 @@ SwipeView {
|
|||
anchors.bottomMargin: 20
|
||||
onClicked: {
|
||||
const selectedAccountIndex = wizardStep1.selectedIndex
|
||||
const response = loginModel.login(selectedAccountIndex, txtPassword.text)
|
||||
const response = loginModel.login(selectedAccountIndex, txtPassword.textField.text)
|
||||
// TODO: replace me with something graphical (ie spinner)
|
||||
console.log("Logging in...")
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import QtQuick.Layouts 1.3
|
|||
import "../imports"
|
||||
|
||||
Item {
|
||||
property alias textField: inputValue
|
||||
property string placeholderText: "My placeholder"
|
||||
property string text: ""
|
||||
property string label: ""
|
||||
|
@ -11,12 +12,12 @@ Item {
|
|||
// property url icon: "../app/img/hash.svg"
|
||||
property url icon: ""
|
||||
readonly property bool hasIcon: icon.toString() !== ""
|
||||
|
||||
readonly property bool hasLabel: label !== ""
|
||||
readonly property var forceActiveFocus: function () {
|
||||
inputValue.forceActiveFocus(Qt.MouseFocusReason)
|
||||
}
|
||||
readonly property int labelMargin: 7
|
||||
property var otherProps // Only used to assign stuff to textField
|
||||
|
||||
id: inputBox
|
||||
height: inputRectangle.height + (hasLabel ? inputLabel.height + labelMargin : 0)
|
||||
|
|
Loading…
Reference in New Issue