summaryrefslogtreecommitdiff
path: root/client/widgets/checkbox.cc
diff options
context:
space:
mode:
authordeva <deva>2008-07-02 07:49:31 +0000
committerdeva <deva>2008-07-02 07:49:31 +0000
commit4d7617cbf20985b7cf2231675d8aadd01f77c3d2 (patch)
tree673a098723c6f6cef90719e0ffa65b2cb31c37b6 /client/widgets/checkbox.cc
parentef408f5639958ce51170978433a0e483240a3ff2 (diff)
Added disable/enable methods on widgets and exposed them to lua.
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();
+}