summaryrefslogtreecommitdiff
path: root/client/widgets/widget.cc
diff options
context:
space:
mode:
Diffstat (limited to 'client/widgets/widget.cc')
-rw-r--r--client/widgets/widget.cc20
1 files changed, 12 insertions, 8 deletions
diff --git a/client/widgets/widget.cc b/client/widgets/widget.cc
index cc74553..fba2da0 100644
--- a/client/widgets/widget.cc
+++ b/client/widgets/widget.cc
@@ -68,6 +68,9 @@ Widget::Widget(QDomNode &node, MacroWindow *macrowindow)
is_valid = true;
+ connect(this, SIGNAL(eventOnChange()),
+ this, SLOT(runEventOnChange()), Qt::QueuedConnection);
+
DEBUG(widget, "Create Widget '%s' of type '%s'\n",
name().toStdString().c_str(),
type().toStdString().c_str());
@@ -132,15 +135,16 @@ void Widget::setValid(bool valid)
{
is_valid = valid;
setWdgValid(valid);
-
+ /*
QVector< Widget* >::iterator i = children.begin();
while(i != children.end()) {
if(*i) (*i)->setValid(valid);
i++;
}
+ */
}
-void Widget::eventOnChange(bool deep)
+void Widget::runEventOnChange(bool deep)
{
if(enabled() && hasOnChangeEvent)
lua->runScript(onChangeEventScript, this, "onChange");
@@ -149,7 +153,7 @@ void Widget::eventOnChange(bool deep)
QVector< Widget* >::iterator i = children.begin();
while(i != children.end()) {
- if(*i) (*i)->eventOnChange(deep);
+ if(*i) (*i)->runEventOnChange(deep);
i++;
}
}
@@ -157,12 +161,12 @@ void Widget::eventOnChange(bool deep)
void Widget::setEnabled(bool enabled)
{
widget->setEnabled(enabled);
- if(enabled) eventOnChange();
+ if(enabled) emit eventOnChange();
else setValid(true); // Force disabled widgets to be valid
QVector< Widget* >::iterator i = children.begin();
while(i != children.end()) {
- if(*i) (*i)->eventOnChange(true);
+ if(*i) (*i)->runEventOnChange(true);
i++;
}
@@ -176,11 +180,11 @@ bool Widget::enabled()
void Widget::setVisible(bool visible)
{
widget->setVisible(visible);
- if(visible) eventOnChange();
+ if(visible) emit eventOnChange();
QVector< Widget* >::iterator i = children.begin();
while(i != children.end()) {
- if(*i) (*i)->eventOnChange(true);
+ if(*i) (*i)->runEventOnChange(true);
i++;
}
}
@@ -264,7 +268,7 @@ void Widget::addChildren(QDomNode &node, QLayout *layout)
void Widget::setValues()
{
if(has_lazy) setValue(lazy_value, lazy_source);
- else eventOnChange(); // Make sure we run validation on the unset widget.
+ else emit eventOnChange(); // Make sure we run validation on the unset widget.
QVector< Widget* >::iterator i = children.begin();
while(i != children.end()) {