summaryrefslogtreecommitdiff
path: root/client/widgets/label.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/label.cc
parentce667bf4b2f3de7aab677ac7e7f23bc72d3db80f (diff)
added error check for unnamed widgets
Diffstat (limited to 'client/widgets/label.cc')
-rw-r--r--client/widgets/label.cc17
1 files changed, 15 insertions, 2 deletions
diff --git a/client/widgets/label.cc b/client/widgets/label.cc
index b6f93b5..b1875e4 100644
--- a/client/widgets/label.cc
+++ b/client/widgets/label.cc
@@ -30,8 +30,19 @@
Label::Label(QDomNode node) : QLabel()
{
QDomElement elem = node.toElement();
- widget_name = elem.attribute("name");
- setText(elem.attribute("caption"));
+
+ 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("align")) {
if(elem.attribute("align") == "left") {
@@ -41,6 +52,8 @@ Label::Label(QDomNode node) : QLabel()
} else if (elem.attribute("align") == "right") {
setAlignment(Qt::AlignRight);
}
+ } else {
+ setAlignment(Qt::AlignLeft);
}
}