summaryrefslogtreecommitdiff
path: root/client/widgets
diff options
context:
space:
mode:
authordeva <deva>2010-08-19 12:52:30 +0000
committerdeva <deva>2010-08-19 12:52:30 +0000
commit024c2a5905c3f82a360e636d9f7db9941e30db23 (patch)
tree70998e5765f7bb0a88a9e95af7d69520a4288dbe /client/widgets
parent0e5a692d5fb6d04e7ffebdc325f7c319dc4c6d24 (diff)
More enable/valid fixes.
Diffstat (limited to 'client/widgets')
-rw-r--r--client/widgets/widget.cc34
-rw-r--r--client/widgets/widget.h2
2 files changed, 30 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;
diff --git a/client/widgets/widget.h b/client/widgets/widget.h
index 5d5f816..d964974 100644
--- a/client/widgets/widget.h
+++ b/client/widgets/widget.h
@@ -102,6 +102,8 @@ private:
void createWidget(QDomNode &xml_node, QLayout *layout);
QVector< Widget* > children;
+ void setWdgValidRecursive(bool valid);
+
// Store value in constructor to be set later.
bool has_lazy;
QString lazy_value;