summaryrefslogtreecommitdiff
path: root/client/widgets/checkbox.cc
diff options
context:
space:
mode:
Diffstat (limited to 'client/widgets/checkbox.cc')
-rw-r--r--client/widgets/checkbox.cc25
1 files changed, 21 insertions, 4 deletions
diff --git a/client/widgets/checkbox.cc b/client/widgets/checkbox.cc
index 0585abf..8474e58 100644
--- a/client/widgets/checkbox.cc
+++ b/client/widgets/checkbox.cc
@@ -42,13 +42,15 @@ CheckBox::CheckBox(QDomNode &node, MacroWindow *macrowindow)
if(elem.hasAttribute("caption")) {
setText(elem.attribute("caption"));
} else {
- setText(elem.attribute(""));
+ setText("");
}
+ connect(this, SIGNAL(stateChanged(int)), this, SLOT(state_change()));
+
if(elem.hasAttribute("value")) {
setValue(elem.attribute("value"));
} else {
- setChecked(false);
+ setValue("false");
}
}
@@ -60,11 +62,26 @@ QString CheckBox::getValue()
void CheckBox::setValue(QString value)
{
- if(value == "true") setChecked(true);
- else setChecked(false);
+ bool old = isChecked();
+
+ if(value == "true") {
+ setChecked(true);
+ } else {
+ setChecked(false);
+ }
+
+ // If set operation did not change the value we must invocate the code manually.
+ if(old == isChecked()) state_change();
}
bool CheckBox::isValid()
{
return true;
}
+
+void CheckBox::state_change()
+{
+ printf("state_change\n");
+
+ luaValidator();
+}