diff options
Diffstat (limited to 'client/widgets')
-rw-r--r-- | client/widgets/lineedit.cc | 26 | ||||
-rw-r--r-- | client/widgets/lineedit.h | 3 | ||||
-rw-r--r-- | client/widgets/radiobuttons.cc | 7 | ||||
-rw-r--r-- | client/widgets/radiobuttons.h | 3 |
4 files changed, 32 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(); + } +} diff --git a/client/widgets/lineedit.h b/client/widgets/lineedit.h index c8ba808..556e52c 100644 --- a/client/widgets/lineedit.h +++ b/client/widgets/lineedit.h @@ -61,6 +61,9 @@ public slots: signals: void wasChanged(); +protected: + void changeEvent(QEvent *event); + private: bool eventFilter(QObject *, QEvent *event); }; diff --git a/client/widgets/radiobuttons.cc b/client/widgets/radiobuttons.cc index d11c3e5..9c5f8ad 100644 --- a/client/widgets/radiobuttons.cc +++ b/client/widgets/radiobuttons.cc @@ -183,3 +183,10 @@ bool RadioButtons::isDisabled() { return isEnabled() == false; } + +void RadioButtons::changeEvent(QEvent *event) +{ + if(event->type() == QEvent::EnabledChange) { + setBGColor(!isEnabled()); + } +} diff --git a/client/widgets/radiobuttons.h b/client/widgets/radiobuttons.h index a32147b..9b165c9 100644 --- a/client/widgets/radiobuttons.h +++ b/client/widgets/radiobuttons.h @@ -63,6 +63,9 @@ public slots: signals: void wasChanged(); +protected: + void changeEvent(QEvent *event); + private: QVector < RadioButton* > radiobutton_list; |