summaryrefslogtreecommitdiff
path: root/client/widgets/lineedit.cc
diff options
context:
space:
mode:
Diffstat (limited to 'client/widgets/lineedit.cc')
-rw-r--r--client/widgets/lineedit.cc26
1 files changed, 19 insertions, 7 deletions
diff --git a/client/widgets/lineedit.cc b/client/widgets/lineedit.cc
index 7c2558b..e7ec9ce 100644
--- a/client/widgets/lineedit.cc
+++ b/client/widgets/lineedit.cc
@@ -56,17 +56,22 @@ void LineEdit::changed()
{
QPalette palette;
- if(regexpValidator()) {
- if(luaValidator()) {
- // valid string
- palette.setBrush(QPalette::Base, QBrush(QColor(255, 255, 255)));
+ if(isEnabled()) {
+ if(regexpValidator()) {
+ if(luaValidator()) {
+ // valid string
+ palette.setBrush(QPalette::Base, QBrush(QColor(255, 255, 255)));
+ } else {
+ // invalid string
+ palette.setBrush(QPalette::Base, QBrush(QColor(200, 230, 200)));
+ }
} else {
// invalid string
- palette.setBrush(QPalette::Base, QBrush(QColor(200, 230, 200)));
+ palette.setBrush(QPalette::Base, QBrush(QColor(230, 200, 200)));
}
} else {
- // invalid string
- palette.setBrush(QPalette::Base, QBrush(QColor(230, 200, 200)));
+ // valid string
+ palette.setBrush(QPalette::Base, QBrush(QColor(255, 255, 255)));
}
setPalette(palette);
@@ -143,3 +148,10 @@ bool LineEdit::eventFilter(QObject *, QEvent *event)
}
return false;
}
+
+void LineEdit::changeEvent(QEvent *event)
+{
+ if(event->type() == QEvent::EnabledChange) {
+ changed();
+ }
+}