From 0c55133c37b9ebb4b7db55e3583fea0555c24857 Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Mon, 8 May 2023 20:02:43 +0800 Subject: [PATCH] Add ability for NCInputTextField to display red border when invalid input provided Signed-off-by: Claudio Cambra --- src/gui/filedetails/NCInputTextField.qml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gui/filedetails/NCInputTextField.qml b/src/gui/filedetails/NCInputTextField.qml index 37a7d23dc8b6f..fa4bef0bfc8a2 100644 --- a/src/gui/filedetails/NCInputTextField.qml +++ b/src/gui/filedetails/NCInputTextField.qml @@ -25,6 +25,7 @@ TextField { readonly property color accentColor: Style.ncBlue readonly property color secondaryColor: palette.dark readonly property alias submitButton: submitButton + property bool validInput: true implicitHeight: Style.talkReplyTextFieldPreferredHeight @@ -36,7 +37,7 @@ TextField { id: textFieldBorder radius: Style.slightlyRoundedButtonRadius border.width: Style.normalBorderWidth - border.color: root.activeFocus ? root.accentColor : root.secondaryColor + border.color: root.activeFocus ? root.validInput ? root.accentColor : Style.errorBoxBackgroundColor : root.secondaryColor color: palette.base } @@ -55,7 +56,7 @@ TextField { icon.source: "image://svgimage-custom-color/confirm.svg" + "/" + root.secondaryColor icon.color: hovered && enabled ? UserModel.currentUser.accentColor : root.secondaryColor - enabled: root.text !== "" + enabled: root.text !== "" && root.validInput onClicked: root.accepted() }