diff options
Diffstat (limited to 'client/widgets/radiobutton.cc')
-rw-r--r-- | client/widgets/radiobutton.cc | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/client/widgets/radiobutton.cc b/client/widgets/radiobutton.cc index 0645745..00c12b9 100644 --- a/client/widgets/radiobutton.cc +++ b/client/widgets/radiobutton.cc @@ -25,30 +25,40 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ #include "radiobutton.h" +#include <QRadioButton> -RadioButton::RadioButton(QDomNode node) - : QRadioButton(), Widget(node) +RadioButton::RadioButton(QDomNode node, bool radio_bool) + : QRadioButton() { QDomElement elem = node.toElement(); + if(elem.hasAttribute("width")) { + resize(elem.attribute("width").toInt(), height()); + } + + if(elem.hasAttribute("height")) { + resize(width(), elem.attribute("height").toInt()); + } + if(elem.hasAttribute("caption")) { setText(elem.attribute("caption")); } else { setText(""); } - if(elem.hasAttribute("value")) { - if(elem.attribute("value") == "true") { + if(radio_bool) { setChecked(true); - } else if(elem.attribute("value") == "false") { - setChecked(false); - } + } else setChecked(false); + + if(elem.hasAttribute("value")) { + radio_value = elem.attribute("value"); } else { - setChecked(false); + printf("XML ERROR!!! Radiobutton item has no value\n"); + radio_value = "none"; } } QString RadioButton::getValue() { - return "radiobutton"; + return radio_value; } |