From 8e4159885b000b007ab820ffba3c39d257c1bdfb Mon Sep 17 00:00:00 2001 From: deva Date: Thu, 19 Aug 2010 09:09:45 +0000 Subject: Fixed missing recursive setValid on setEnabled. --- client/widgets/widget.cc | 12 +++++++----- client/widgets/widget.h | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/client/widgets/widget.cc b/client/widgets/widget.cc index fba2da0..d4d0826 100644 --- a/client/widgets/widget.cc +++ b/client/widgets/widget.cc @@ -131,17 +131,19 @@ bool Widget::valid(bool deep) return true; } -void Widget::setValid(bool valid) +void Widget::setValid(bool valid, bool deep) { is_valid = valid; setWdgValid(valid); - /* + + if(!deep) return; + QVector< Widget* >::iterator i = children.begin(); while(i != children.end()) { - if(*i) (*i)->setValid(valid); + if(*i) (*i)->setValid(valid, deep); i++; } - */ + } void Widget::runEventOnChange(bool deep) @@ -162,7 +164,7 @@ void Widget::setEnabled(bool enabled) { widget->setEnabled(enabled); if(enabled) emit eventOnChange(); - else setValid(true); // Force disabled widgets to be valid + else setValid(true, true); // Force disabled widgets to be valid QVector< Widget* >::iterator i = children.begin(); while(i != children.end()) { diff --git a/client/widgets/widget.h b/client/widgets/widget.h index 17480cb..5d5f816 100644 --- a/client/widgets/widget.h +++ b/client/widgets/widget.h @@ -54,7 +54,7 @@ public: // Set deep to true to validate inner widgets. bool valid(bool deep = false); - void setValid(bool valid); + void setValid(bool valid, bool deep = false); // Implement in subclasses to contribute to the validation. virtual bool preValid() { return true; } -- cgit v1.2.3