feat(StatusBaseInput): add visual validity state

Closes #287
This commit is contained in:
Pascal Precht 2021-07-23 12:07:51 +02:00 committed by Pascal Precht
parent de1cec7e51
commit e8cce72c25
2 changed files with 10 additions and 0 deletions

View File

@ -24,6 +24,11 @@ Column {
clearable: true clearable: true
} }
StatusBaseInput {
placeholderText: "Invalid"
valid: false
}
StatusBaseInput { StatusBaseInput {
multiline: true multiline: true
placeholderText: "Multiline" placeholderText: "Multiline"

View File

@ -40,6 +40,8 @@ Item {
property real minimumHeight: 0 property real minimumHeight: 0
property real maximumHeight: 0 property real maximumHeight: 0
property bool valid: true
implicitWidth: 448 implicitWidth: 448
implicitHeight: multiline ? Math.max(edit.implicitHeight + topPadding + bottomPadding, 40) : 40 implicitHeight: multiline ? Math.max(edit.implicitHeight + topPadding + bottomPadding, 40) : 40
@ -57,6 +59,9 @@ Item {
border.width: 1 border.width: 1
border.color: { border.color: {
if (!statusBaseInput.valid) {
return Theme.palette.dangerColor1;
}
if (edit.activeFocus) { if (edit.activeFocus) {
return Theme.palette.primaryColor1; return Theme.palette.primaryColor1;
} }