summaryrefslogtreecommitdiff
path: root/client/widgets/checkbox.cc
diff options
context:
space:
mode:
authorsenator <senator>2007-07-26 13:10:25 +0000
committersenator <senator>2007-07-26 13:10:25 +0000
commite1bbdd89f09966a240e8a7b8007dc44895e0febd (patch)
tree0e990d7a9df1d7c2fc53aaee0bc52990a6607b60 /client/widgets/checkbox.cc
parentce667bf4b2f3de7aab677ac7e7f23bc72d3db80f (diff)
added error check for unnamed widgets
Diffstat (limited to 'client/widgets/checkbox.cc')
-rw-r--r--client/widgets/checkbox.cc25
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);
}
}