From 0ffee3f4265896cb43cf2c45c60f592f3f197ab6 Mon Sep 17 00:00:00 2001 From: Pascal Precht Date: Fri, 23 Jul 2021 12:07:51 +0200 Subject: [PATCH] feat(StatusBaseInput): add visual validity state Closes #287 --- ui/StatusQ/sandbox/StatusInputPage.qml | 5 +++++ ui/StatusQ/src/StatusQ/Controls/StatusBaseInput.qml | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/ui/StatusQ/sandbox/StatusInputPage.qml b/ui/StatusQ/sandbox/StatusInputPage.qml index 033ea411a1..8460410ea2 100644 --- a/ui/StatusQ/sandbox/StatusInputPage.qml +++ b/ui/StatusQ/sandbox/StatusInputPage.qml @@ -24,6 +24,11 @@ Column { clearable: true } + StatusBaseInput { + placeholderText: "Invalid" + valid: false + } + StatusBaseInput { multiline: true placeholderText: "Multiline" diff --git a/ui/StatusQ/src/StatusQ/Controls/StatusBaseInput.qml b/ui/StatusQ/src/StatusQ/Controls/StatusBaseInput.qml index ccba50f459..1547c27f38 100644 --- a/ui/StatusQ/src/StatusQ/Controls/StatusBaseInput.qml +++ b/ui/StatusQ/src/StatusQ/Controls/StatusBaseInput.qml @@ -40,6 +40,8 @@ Item { property real minimumHeight: 0 property real maximumHeight: 0 + property bool valid: true + implicitWidth: 448 implicitHeight: multiline ? Math.max(edit.implicitHeight + topPadding + bottomPadding, 40) : 40 @@ -57,6 +59,9 @@ Item { border.width: 1 border.color: { + if (!statusBaseInput.valid) { + return Theme.palette.dangerColor1; + } if (edit.activeFocus) { return Theme.palette.primaryColor1; }