diff options
author | deva <deva> | 2008-07-02 07:49:31 +0000 |
---|---|---|
committer | deva <deva> | 2008-07-02 07:49:31 +0000 |
commit | 4d7617cbf20985b7cf2231675d8aadd01f77c3d2 (patch) | |
tree | 673a098723c6f6cef90719e0ffa65b2cb31c37b6 /client/widgets/checkbox.cc | |
parent | ef408f5639958ce51170978433a0e483240a3ff2 (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.cc | 25 |
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(); +} |