From 8ea5a46f39a421c60768187740fb427084eacda0 Mon Sep 17 00:00:00 2001 From: deva Date: Mon, 30 Jun 2008 09:38:56 +0000 Subject: Modified getValue, and introduced a setValue method. --- client/widgets/checkbox.cc | 16 ++++++++-------- client/widgets/checkbox.h | 1 + 2 files changed, 9 insertions(+), 8 deletions(-) (limited to 'client/widgets') 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); }; -- cgit v1.2.3