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