diff options
Diffstat (limited to 'client')
-rw-r--r-- | client/widgets/checkbox.cc | 16 | ||||
-rw-r--r-- | client/widgets/checkbox.h | 1 |
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); }; |