From 6391eee732d7516a30eb93cddea4cf190026da94 Mon Sep 17 00:00:00 2001 From: deva Date: Fri, 26 Feb 2010 10:45:50 +0000 Subject: Make disabled widgets drawn as valid always (non-red). --- client/widgets/combobox.cc | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'client/widgets/combobox.cc') 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(); + } +} -- cgit v1.2.3