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.cc42
1 files changed, 38 insertions, 4 deletions
diff --git a/client/widgets/checkbox.cc b/client/widgets/checkbox.cc
index 1b8d64b..4fbdad1 100644
--- a/client/widgets/checkbox.cc
+++ b/client/widgets/checkbox.cc
@@ -31,6 +31,8 @@
CheckBox::CheckBox(QDomNode &node, MacroWindow *macrowindow)
: QCheckBox(), Widget(node, macrowindow)
{
+ changedByUser = true;
+
setCommonAttributes(this, node);
QDomElement elem = node.toElement();
@@ -51,7 +53,7 @@ CheckBox::CheckBox(QDomNode &node, MacroWindow *macrowindow)
falsevalue = "false";
}
- connect(this, SIGNAL(stateChanged(int)), this, SLOT(state_change()));
+ connect(this, SIGNAL(stateChanged(int)), this, SLOT(state_change(int)));
}
QString CheckBox::getValue()
@@ -60,8 +62,12 @@ QString CheckBox::getValue()
return falsevalue;
}
-void CheckBox::setValue(QString value)
+void CheckBox::setValue(QString value, QString source)
{
+ if(isUserSource(source)) emit wasChanged();
+
+ changedByUser = false;
+
bool old = isChecked();
if(value == truevalue) {
@@ -73,7 +79,11 @@ void CheckBox::setValue(QString value)
}
// If set operation did not change the value we must invocate the code manually.
- if(old == isChecked()) state_change();
+ if(old == isChecked()) state_change(0);
+
+ setInitialValue(value);
+
+ changedByUser = true;
}
/*
bool CheckBox::isValid()
@@ -81,7 +91,31 @@ bool CheckBox::isValid()
return luaValidator();
}
*/
-void CheckBox::state_change()
+void CheckBox::state_change(int)
{
+ if(changedByUser) emit wasChanged();
luaValidator();
}
+
+void CheckBox::connectFrom(const char *signal,
+ const QObject *receiver, const char *method)
+{
+ connect(this, signal, receiver, method);
+}
+
+void CheckBox::connectTo(const QObject *sender, const char *signal,
+ const char *method)
+{
+ connect(sender, signal, this, method);
+}
+
+void CheckBox::setVisibility(bool visible)
+{
+ setVisible(visible);
+}
+
+bool CheckBox::setKeyboardFocus()
+{
+ setFocus();
+ return true;
+}