diff options
author | deva <deva> | 2010-04-29 12:26:01 +0000 |
---|---|---|
committer | deva <deva> | 2010-04-29 12:26:01 +0000 |
commit | 0d76adfb6dce6dec1367913752f7b0a818e1bc21 (patch) | |
tree | db67eab193681dea72df4a14bbdac39b67fcf106 /client/widgets/combobox.cc | |
parent | c96a2e557f0a9322c9369a06041e894cc2f11e93 (diff) |
Backported some widget behaviour from head.
Diffstat (limited to 'client/widgets/combobox.cc')
-rw-r--r-- | client/widgets/combobox.cc | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/client/widgets/combobox.cc b/client/widgets/combobox.cc index bf25475..f81d989 100644 --- a/client/widgets/combobox.cc +++ b/client/widgets/combobox.cc @@ -30,6 +30,7 @@ #include <QRegExpValidator> #include <QRegExp> #include <QLineEdit> +#include <QCoreApplication> #include "common.h" @@ -170,12 +171,17 @@ void ComboBox::changed() QPalette palette; - if(isValid() && luaValidator()) { + if(isEnabled()) { + if(isValid() && luaValidator()) { + // valid string + palette.setBrush(QPalette::Base, QBrush(QColor(255, 255, 255))); + } else { + // invalid string + palette.setBrush(QPalette::Base, QBrush(QColor(230, 200, 200))); + } + } else { // valid string palette.setBrush(QPalette::Base, QBrush(QColor(255, 255, 255))); - } else { - // invalid string - palette.setBrush(QPalette::Base, QBrush(QColor(230, 200, 200))); } if(lineEdit()) lineEdit()->setPalette(palette); @@ -230,3 +236,15 @@ bool ComboBox::eventFilter(QObject *obj, QEvent *event) return QObject::eventFilter(obj, event); } + +void ComboBox::wheelEvent(QWheelEvent *e) +{ + QCoreApplication::sendEvent(nativeParentWidget(), e); +} + +void ComboBox::changeEvent(QEvent *event) +{ + if(event->type() == QEvent::EnabledChange) { + changed(); + } +} |