summaryrefslogtreecommitdiff
path: root/client/widgets
diff options
context:
space:
mode:
authordeva <deva>2008-06-30 09:38:56 +0000
committerdeva <deva>2008-06-30 09:38:56 +0000
commit8ea5a46f39a421c60768187740fb427084eacda0 (patch)
tree3d51a8285d86e2398f762c314e1c12987ffd2c37 /client/widgets
parent806d2bc2800f88ce7f31965a12af6e2273af7ce6 (diff)
Modified getValue, and introduced a setValue method.
Diffstat (limited to 'client/widgets')
-rw-r--r--client/widgets/checkbox.cc16
-rw-r--r--client/widgets/checkbox.h1
2 files changed, 9 insertions, 8 deletions
diff --git a/client/widgets/checkbox.cc b/client/widgets/checkbox.cc
index 6b6f0e8..0585abf 100644
--- a/client/widgets/checkbox.cc
+++ b/client/widgets/checkbox.cc
@@ -32,12 +32,10 @@ CheckBox::CheckBox(QDomNode &node, MacroWindow *macrowindow)
QDomElement elem = node.toElement();
if(elem.hasAttribute("width")) {
- //resize(elem.attribute("width").toInt(), height());
setMinimumWidth(elem.attribute("width").toInt());
}
if(elem.hasAttribute("height")) {
- //resize(width(), elem.attribute("height").toInt());
setMinimumHeight(elem.attribute("height").toInt());
}
@@ -48,11 +46,7 @@ CheckBox::CheckBox(QDomNode &node, MacroWindow *macrowindow)
}
if(elem.hasAttribute("value")) {
- if(elem.attribute("value") == "true") {
- setChecked(true);
- } else if (elem.attribute("value") == "false") {
- setChecked(false);
- }
+ setValue(elem.attribute("value"));
} else {
setChecked(false);
}
@@ -60,10 +54,16 @@ CheckBox::CheckBox(QDomNode &node, MacroWindow *macrowindow)
QString CheckBox::getValue()
{
- if(checkState() == Qt::Checked) return "true";
+ if(isChecked()) return "true";
return "false";
}
+void CheckBox::setValue(QString value)
+{
+ if(value == "true") setChecked(true);
+ else setChecked(false);
+}
+
bool CheckBox::isValid()
{
return true;
diff --git a/client/widgets/checkbox.h b/client/widgets/checkbox.h
index e24792c..9db7bf2 100644
--- a/client/widgets/checkbox.h
+++ b/client/widgets/checkbox.h
@@ -40,6 +40,7 @@ public:
public slots:
QString getValue();
+ void setValue(QString value);
};