summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authordeva <deva>2010-02-26 10:45:50 +0000
committerdeva <deva>2010-02-26 10:45:50 +0000
commit6391eee732d7516a30eb93cddea4cf190026da94 (patch)
tree539ce8ab7c8af6ce9153dd78e207cd45eeb0c172 /client
parent18069e35a2d1e8a13511c32dd965aac5002dae5f (diff)
Make disabled widgets drawn as valid always (non-red).
Diffstat (limited to 'client')
-rw-r--r--client/widgets/combobox.cc20
-rw-r--r--client/widgets/combobox.h1
-rw-r--r--client/widgets/radiobuttons.cc2
3 files changed, 18 insertions, 5 deletions
diff --git a/client/widgets/combobox.cc b/client/widgets/combobox.cc
index 59f7604..f81d989 100644
--- a/client/widgets/combobox.cc
+++ b/client/widgets/combobox.cc
@@ -171,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);
@@ -236,3 +241,10 @@ void ComboBox::wheelEvent(QWheelEvent *e)
{
QCoreApplication::sendEvent(nativeParentWidget(), e);
}
+
+void ComboBox::changeEvent(QEvent *event)
+{
+ if(event->type() == QEvent::EnabledChange) {
+ changed();
+ }
+}
diff --git a/client/widgets/combobox.h b/client/widgets/combobox.h
index 3cdebfe..8059e81 100644
--- a/client/widgets/combobox.h
+++ b/client/widgets/combobox.h
@@ -71,6 +71,7 @@ signals:
protected:
bool eventFilter(QObject *obj, QEvent *event);
void wheelEvent(QWheelEvent *);
+ void changeEvent(QEvent *event);
private:
QRegExp rx;
diff --git a/client/widgets/radiobuttons.cc b/client/widgets/radiobuttons.cc
index 9c5f8ad..e4555ff 100644
--- a/client/widgets/radiobuttons.cc
+++ b/client/widgets/radiobuttons.cc
@@ -187,6 +187,6 @@ bool RadioButtons::isDisabled()
void RadioButtons::changeEvent(QEvent *event)
{
if(event->type() == QEvent::EnabledChange) {
- setBGColor(!isEnabled());
+ setBGColor(isValid() || !isEnabled());
}
}