summary refs log tree commit diff
path: root/src/ui
diff options
context:
space:
mode:
authorDeepBlueV7.X <nicolas.werner@hotmail.de>2020-11-25 00:22:15 +0100
committerGitHub <noreply@github.com>2020-11-25 00:22:15 +0100
commit45e91a7ee42fdce6776e3790e249a563142fa675 (patch)
tree2378e0d379fc8fa98f6851c3259c0b3bbc3d4b1a /src/ui
parentMerge pull request #332 from Kirillpt/russian-translate (diff)
parentApply suggestions from code review (diff)
downloadnheko-45e91a7ee42fdce6776e3790e249a563142fa675.tar.xz
Merge pull request #334 from Kirillpt/issue_292
fix #292
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/TextField.cpp14
-rw-r--r--src/ui/TextField.h3
2 files changed, 16 insertions, 1 deletions
diff --git a/src/ui/TextField.cpp b/src/ui/TextField.cpp

index 27584693..f717bcba 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 ((hasAcceptableInput() && isValid()) || !isModified()) return QPalette().color(QPalette::Highlight); else return Qt::red; diff --git a/src/ui/TextField.h b/src/ui/TextField.h
index 85d5036d..966155f4 100644 --- a/src/ui/TextField.h +++ b/src/ui/TextField.h
@@ -30,6 +30,7 @@ public: void setLabelFontSize(qreal size); void setShowLabel(bool value); void setUnderlineColor(const QColor &color); + void setValid(bool valid); QColor inkColor() const; QColor labelColor() const; @@ -37,6 +38,7 @@ public: QColor backgroundColor() const; QString label() const; bool hasLabel() const; + bool isValid() const; qreal labelFontSize() const; protected: @@ -54,6 +56,7 @@ private: TextFieldLabel *label_; TextFieldStateMachine *state_machine_; bool show_label_; + bool is_valid_; qreal label_font_size_; };