diff options
author | deva <deva> | 2010-08-18 14:09:16 +0000 |
---|---|---|
committer | deva <deva> | 2010-08-18 14:09:16 +0000 |
commit | 91970dbba11c663f9d6d5b40b8c563dc05b332b9 (patch) | |
tree | 078eea0d5559c0a332162e11cc696576792d8122 /client/widgets/widget.cc | |
parent | abe143670b174e2604c97224df14732bf059f151 (diff) |
Do not enable all children recursively. Make eventOnChange recursive on-demand.
Diffstat (limited to 'client/widgets/widget.cc')
-rw-r--r-- | client/widgets/widget.cc | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/client/widgets/widget.cc b/client/widgets/widget.cc index 9ebed55..cc74553 100644 --- a/client/widgets/widget.cc +++ b/client/widgets/widget.cc @@ -112,6 +112,7 @@ bool Widget::local() bool Widget::valid(bool deep) { if(enabled() == false) return true; + if(visible() == false) return true; if(preValid() == false) return false; if(is_valid == false) return false; @@ -139,10 +140,18 @@ void Widget::setValid(bool valid) } } -void Widget::eventOnChange() +void Widget::eventOnChange(bool deep) { if(enabled() && hasOnChangeEvent) lua->runScript(onChangeEventScript, this, "onChange"); + + if(!deep) return; + + QVector< Widget* >::iterator i = children.begin(); + while(i != children.end()) { + if(*i) (*i)->eventOnChange(deep); + i++; + } } void Widget::setEnabled(bool enabled) @@ -153,7 +162,7 @@ void Widget::setEnabled(bool enabled) QVector< Widget* >::iterator i = children.begin(); while(i != children.end()) { - if(*i) (*i)->setEnabled(enabled); + if(*i) (*i)->eventOnChange(true); i++; } @@ -168,6 +177,12 @@ void Widget::setVisible(bool visible) { widget->setVisible(visible); if(visible) eventOnChange(); + + QVector< Widget* >::iterator i = children.begin(); + while(i != children.end()) { + if(*i) (*i)->eventOnChange(true); + i++; + } } bool Widget::visible() |