diff options
Diffstat (limited to 'client/widgets/checkbox.cc')
-rw-r--r-- | client/widgets/checkbox.cc | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/client/widgets/checkbox.cc b/client/widgets/checkbox.cc index 33cd9d1..c04b104 100644 --- a/client/widgets/checkbox.cc +++ b/client/widgets/checkbox.cc @@ -29,12 +29,27 @@ CheckBox::CheckBox(QDomNode node) : QCheckBox() { QDomElement elem = node.toElement(); - widget_name = elem.attribute("name"); - setText(elem.attribute("caption")); - if(elem.attribute("value") == "true") { - setChecked(true); - } else if (elem.attribute("value") == "false") { + if(elem.hasAttribute("name")) { + widget_name = elem.attribute("name"); + } else { + printf("XML ERROR!! Unnamed widget of type: %s\n", + elem.tagName().toStdString().c_str()); + } + + if(elem.hasAttribute("caption")) { + setText(elem.attribute("caption")); + } else { + setText(elem.attribute("")); + } + + if(elem.hasAttribute("value")) { + if(elem.attribute("value") == "true") { + setChecked(true); + } else if (elem.attribute("value") == "false") { + setChecked(false); + } + } else { setChecked(false); } } |