diff options
author | deva <deva> | 2010-08-19 12:52:30 +0000 |
---|---|---|
committer | deva <deva> | 2010-08-19 12:52:30 +0000 |
commit | 024c2a5905c3f82a360e636d9f7db9941e30db23 (patch) | |
tree | 70998e5765f7bb0a88a9e95af7d69520a4288dbe /client/widgets/widget.cc | |
parent | 0e5a692d5fb6d04e7ffebdc325f7c319dc4c6d24 (diff) |
More enable/valid fixes.
Diffstat (limited to 'client/widgets/widget.cc')
-rw-r--r-- | client/widgets/widget.cc | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/client/widgets/widget.cc b/client/widgets/widget.cc index 9e15bf2..4c44904 100644 --- a/client/widgets/widget.cc +++ b/client/widgets/widget.cc @@ -148,8 +148,12 @@ void Widget::setValid(bool valid, bool deep) void Widget::runEventOnChange(bool deep) { - if(enabled() && hasOnChangeEvent) - lua->runScript(onChangeEventScript, this, "onChange"); + if(enabled()) { + //if(preValid() == false) setWdgValid(false); + setWdgValid(valid()); + if(hasOnChangeEvent) + lua->runScript(onChangeEventScript, this, "onChange"); + } if(!deep) return; @@ -160,12 +164,30 @@ void Widget::runEventOnChange(bool deep) } } +void Widget::setWdgValidRecursive(bool forcevalid) +{ + if(forcevalid) setWdgValid(true); + else setWdgValid(valid()); + + QVector< Widget* >::iterator i = children.begin(); + while(i != children.end()) { + if(*i) (*i)->setWdgValidRecursive(forcevalid); + i++; + } +} + void Widget::setEnabled(bool enabled) { widget->setEnabled(enabled); - if(enabled) emit eventOnChange(); - else setValid(true, true); // Force disabled widgets to be valid + if(enabled == false) setWdgValidRecursive(true); + else setWdgValidRecursive(false); + /* + if(enabled) { + setValid(valid(), true); + emit eventOnChange(); + } else setValid(true, true); // Force disabled widgets to be valid + */ QVector< Widget* >::iterator i = children.begin(); while(i != children.end()) { if(*i) (*i)->runEventOnChange(true); @@ -204,7 +226,7 @@ bool Widget::setKeyboardFocus() Widget *Widget::findWidget(QString n, bool deep) { - DEBUG(widget, "Find Widget %p\n", this); + // DEBUG(widget, "Find Widget %p\n", this); if(n == name()) return this; @@ -224,7 +246,7 @@ Widget *Widget::findWidget(QString n, bool deep) QVector< Widget* > Widget::widgetList(bool deep) { - DEBUG(widget, "Widget List %p\n", this); + // DEBUG(widget, "Widget List %p\n", this); QVector< Widget* > lst; |