From ac73f10eba557588a78a5e9c24a3874c287c5db8 Mon Sep 17 00:00:00 2001 From: kirillpt Date: Mon, 23 Nov 2020 23:33:53 +0300 Subject: move error_matrixid label below matrixid input, made hide/show for the label, made red underline for invalid input, add to TextField class isValid() setValid() for custom validation --- src/ui/TextField.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/ui/TextField.cpp') diff --git a/src/ui/TextField.cpp b/src/ui/TextField.cpp index 27584693..c3eed734 100644 --- a/src/ui/TextField.cpp +++ b/src/ui/TextField.cpp @@ -69,6 +69,18 @@ TextField::hasLabel() const return show_label_; } +bool +TextField::isValid() const +{ + return is_valid_; +} + +void +TextField::setValid(bool valid) +{ + is_valid_ = valid; +} + void TextField::setLabelFontSize(qreal size) { @@ -147,7 +159,7 @@ QColor TextField::underlineColor() const { if (!underline_color_.isValid()) { - if (hasAcceptableInput() || !isModified()) + if (TextField::isValid() || !isModified()) return QPalette().color(QPalette::Highlight); else return Qt::red; -- cgit 1.5.1 From ebe0cd79d7393dea1886aca8207ff5bb633f464a Mon Sep 17 00:00:00 2001 From: "DeepBlueV7.X" Date: Wed, 25 Nov 2020 00:10:13 +0100 Subject: Update src/ui/TextField.cpp --- src/ui/TextField.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui/TextField.cpp') diff --git a/src/ui/TextField.cpp b/src/ui/TextField.cpp index c3eed734..f717bcba 100644 --- a/src/ui/TextField.cpp +++ b/src/ui/TextField.cpp @@ -159,7 +159,7 @@ QColor TextField::underlineColor() const { if (!underline_color_.isValid()) { - if (TextField::isValid() || !isModified()) + if ((hasAcceptableInput() && isValid()) || !isModified()) return QPalette().color(QPalette::Highlight); else return Qt::red; -- cgit 1.5.1